Database.create()

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

Object

true

Document fields containing metadata and settings for the new Database document.

For supported document fields, see Database collection.

Return value

Type Description

DatabaseDef

The new Database document.

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"
}
\