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

Learn: Databases

In Fauna, a database stores data as documents in one or more collections.

Fauna databases support a hierarchical database structure with top-level and child databases.

Database collection

Fauna stores metadata and settings for a database’s child databases as documents in the Database system collection. These documents have the DatabaseDef type.

Database documents have the following FQL structure:

{
  name: "childDB",
  coll: Database,
  ts: Time("2099-06-24T21:53:40.670Z"),
  typechecked: true,
  priority: 10,
  global_id: "ysjpygonryyr1"
}
Field Type Description

name

Name of the database.

coll

Document type name: Database.

ts

Most recent document update timestamp.

global_id

(read-only) Autogenerated, unique database identifier.

typechecked

Type checking enablement:
true = Enable type checking.
false = Disable type checking.

priority

User-defined priority assigned to the database.

data

User-defined document fields. The data field can’t be created.

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.

Static methods

You can use the following static methods to manage the Database collection in FQL.

Method Description

Gets a Set of all Database collection documents.

Gets a Database collection document by its name.

Creates a database.

Gets the first Database collection document that matches a provided predicate.

Gets the name of the Database system collection name as a string.

Gets a Set of Database collection documents that match a provided predicate.

Instance methods

You can use the following instance methods to manage specific Database documents in FQL.

Method Description

Deletes a database.

Verifies that a database exists.

Replaces a database’s metadata and settings.

Updates a database’s metadata and settings.

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!