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 and multi-tenancy |
---|
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: "child_db",
coll: Database,
ts: Time("2099-06-24T21:53:40.670Z"),
typechecked: true,
protected: false,
priority: 10,
global_id: "ysjpygonryyr1",
data: {
desc: "Prod child database"
}
}
Field | Type | Read-only | Required | Description |
---|---|---|---|---|
|
true |
Name of the database. |
||
|
true |
Collection name: |
||
|
true |
Last time the document was created or updated. |
||
|
User-defined priority assigned to the database. |
|||
|
If Inherits the parent database’s typechecking setting. |
|||
|
If Inherits the parent database’s protected mode setting. |
|||
|
true |
Auto-generated, globally unique ID for the database. See Global database ID. |
||
|
|
Arbitrary user-defined metadata for the document. |
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 |
---|---|
Deletes a child database. |
|
Get a child database by its name. |
|
Create a child database. |
|
Get the first child database document that matches a provided predicate. |
|
Get |
|
Get a Set of child databases 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 child database. |
|
Test if a child database exists. |
|
Replace a child database's metadata and settings. |
|
Update a child 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!