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 of the database. |
|
|
Document type name: |
|
|
Most recent document update timestamp. |
|
|
(read-only) Autogenerated, unique database identifier. |
|
|
Type checking enablement: |
|
|
User-defined priority assigned to the database. |
|
|
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 |
|
Gets a |
|
Creates a database. |
|
Gets the first |
|
Gets the name of the |
|
Gets a Set of |
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!