replace()

Replace an database field.

Signature

replace(object: {*: Any}): DatabaseDef

Description

The replace() method replaces the given object database field values with the given object values. The given fields must exist and be mutable.

Parameters

Parameter Type Required Description

object

Object

Yes

Replacement database fields.

Return value

Type Description

DatabaseDef

Database with replaced fields.

Examples

Database.byName("DemoChildDB")!.replace({name: "MyChildDB"})
{
  name: "MyChildDB",
  coll: Database,
  ts: Time("2023-11-09T10:05:13.740Z"),
  global_id: "yirw85d1wyyrn"
}

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!