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.byName()

Learn: Databases and multi-tenancy

Get a child database by its name.

Signature

Database.byName(name: String) => NamedRef<DatabaseDef>

Description

Gets a child database, represented as an Database document, by its name.

Fauna stores child databases as documents in the parent database’s Database system collection. Database documents have the DatabaseDef type.

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

name

String

true

name of the Database document to retrieve.

Return value

Type Description

NamedRef<DatabaseDef>

Resolved reference to the Database document. Can resolve to an existing document or a NullDoc.

Examples

Database.byName("childDB")
{
  name: "childDB",
  coll: Database,
  ts: Time("2099-06-24T21:54:38.890Z"),
  global_id: "ysjpykbahyyr1",
  priority: 10,
  typechecked: true
}

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!