Database.all()
Gets a set of all Database
collection documents.
Description
The Database.all()
method returns all documents in the Database
system
collection or, optionally, the set of databases in the given range.
Scope
The Database
collection only contains documents for the direct child databases
of the database scoped to your authentication secret. You can’t use the
Database
collection to access parent, peer, or other descendant databases.
If you use an authentication secret scoped to an account’s top-level context,
the Database
collection contains documents for the account’s top-level
databases. You can create a top-level secret using the
Fauna CLI's
cloud-login
command.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
range |
Object describing the range. Returns all members of the set greater than or equal to from and less than or equal to to, including duplicates for an unordered set. If range is omitted, the method returns all Database objects. |
Return value
Type | Description |
---|---|
Set<DatabaseDef> |
All Database objects or objects in the given range. If the resulting set is empty, the method returns an empty set. For an ordered set, if from is greater than to, the method returns an empty set. If the first member of the set is greater than or equal to from and also less than or equal to to only that value is returned. |
Examples
Database.all()
{
data: [
{
name: "childDB",
coll: Database,
ts: Time("2099-06-24T21:54:38.890Z"),
typechecked: true,
priority: 10,
global_id: "ysjpykbahyyr1"
},
...
]
}
Database.all({ from: Database.byName("childDB") })
{
data: [
{
name: "childDB",
coll: Database,
ts: Time("2099-06-24T21:54:38.890Z"),
typechecked: true,
priority: 10,
global_id: "ysjpykbahyyr1"
},
...
]
}
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!