Database.create()

Create a child database.

Signature

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

Description

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

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: [a-zA-Z_]+[a-zA-Z0-9_]*.

  • The name can’t be a single underscore (_).

  • The name can’t be a reserved word.

  • Because databases are similar to traditional objects, Fauna recommends using a singular name that follows your class and struct formatting convention.

  • 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!