Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

Database.all()

Learn: Databases and multi-tenancy

Get a Set of all child databases nested directly under the database.

Signature

Database.all() => Set<DatabaseDef>

Database.all(range: { from: Any } | { to: Any } | { from: Any, to: Any }) => Set<DatabaseDef>

Description

Gets a Set containing all child databases, represented as Database documents, nested directly under the database to which the query’s authentication secret is scoped. To limit the returned Set, you can provide an optional range.

If this method is the last expression in a query, the first page of the Set is returned. See Pagination.

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.

Using FQL to create or manage top-level databases is not supported.

Parameters

Parameter Type Required Description

range

{ from: Any } | { to: Any } | { from: Any, to: Any }

Specifies a range of Database documents in the form { from: start, to: end }. from and to arguments should be in the order returned by an unbounded Database.all() call. See Range examples.

The Set only includes documents in this range (inclusive). Omit from or to to run unbounded range searches.

If a range is omitted, all credentials are returned.

Range parameters

Name Type Required Description

from

Any

Beginning of the range (inclusive). Must be an Database document.

to

Any

End of the range (inclusive). Must be an Database document.

Return value

Type Description

Set<DatabaseDef>

Set of Database documents in the provided range. If a range is omitted, all credentials are returned.

The Set is empty if:

  • The database has no child databases.

  • There are no child databases in the provided range.

  • The provided range’s from value is greater than to.

Examples

Range 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!