Database.create()

Create a child database.

Signature

Database.create(data: {*: any}): <Document>

Description

The create() method creates a child database with the provided data database definition.

Parameters

Parameter Type Required Description

data

Object

Yes

Object describing the child database.

data fields

Name Type Required Description

name

String

Yes

Name of the database to create. The name must match the following regular expression but can’t be a single underscore or reserved word: [a-zA-Z][a-zA-Z0-9_]*.
A name should be singular and PascalCased.
See the aliasing section about renaming existing entities.

history_days

Number

Number of days for document retention for the collection.
Default = 0

priority

Number

User-defined priority assigned to the child database.

typechecked

Boolean

Enable type checking:
    true = Enable type checking.
    false = (default) Disable type checking.
If not set for a child database, the child database inherits the typechecked state of the parent database.

data

Object

Metadata for the database.

Return value

Type Description

DatabaseDef

New Database document.

Examples

Database.create({
name: "Growers",
typechecked: true,
priority: 10
})
{
  name: "Growers",
  coll: Database,
  ts: Time("2023-06-05T19:44:23.040Z"),
  global_id: "ywmp5m111yyre",
  typechecked: true,
  priority: 10
}

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!