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.update()

Learn: Databases and multi-tenancy

Update a child database's metadata and settings.

Signature

update(data: { *: Any }) => DatabaseDef

Description

Updates a child database's metadata and settings, represented as a Database document, with fields from a provided data object.

Fauna stores child databases as documents in the parent database’s Database system collection. Database documents have the DatabaseDef type.

During the update, fields from the data object are copied to the document, creating new fields or updating existing fields. The operation is similar to a merge.

Nested fields

Fields with nested objects in the data object are merged with the identically named nested object in the document.

Remove a field

To remove a document field, set its value in the data object to null.

Metadata fields

You can’t use this method to insert or edit the following metadata fields:

  • coll

  • ts

Parameters

Parameter Type Required Description

data

Object

true

Document fields for the Database document.

For supported document fields, see Database collection.

The object can’t include the following metadata fields:

* coll * ts

Return value

Type Description

DatabaseDef

The updated Database document.

Examples

Database.byName("childDB")!.update({typechecked: false})
{
  name: "childDB",
  coll: Database,
  ts: Time("2099-06-24T21:58:19.346Z"),
  priority: 10,
  global_id: "ysjpykbahyyr1",
  typechecked: false
}

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!