Check out v4 of the Fauna CLI
v4 of the Fauna CLI is now GA. The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start. Migrating from v3 of the CLI? See the CLI migration guide. |
Database.create()
Learn: Databases and multi-tenancy |
---|
Create a child database.
Signature
Database.create(data: { name: String, priority: Number | Null, typechecked: Boolean | Null, protected: Boolean | Null, data: { *: Any } | Null }) => DatabaseDef
Description
Creates a child database with the provided metadata and settings. The parent database is the database to which the query’s the authentication secret is scoped.
Using Database.create()
to create a top-level database is not supported.
Fauna stores child databases as documents in the parent database’s
Database
system collection.
Database
documents have the DatabaseDef type.
Database backups
You can’t use this method to enable backups on a child database. You can only enable backups in the Fauna Dashboard. See Database backup and restore .
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
data |
true |
Document fields containing metadata and settings for the new
For supported document fields, see
|
Return value
Type | Description |
---|---|
The new |
Examples
Database.create({
name: "childDB",
typechecked: true,
priority: 10
})
{
name: "childDB",
coll: Database,
ts: Time("2099-06-24T21:53:40.670Z"),
typechecked: true,
priority: 10,
global_id: "ysjpygonryyr1"
}
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!