key.replace()
Replace an key.
Description
The replace()
method replaces keys with the document supplied.
This method removes any fields not supplied by the document, with
some exceptions. The immutable metadata fields id
, coll
and ts
aren’t
removed and can’t be replaced.
The document must include the required fields.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
object |
Yes |
Object with the replacement document fields. |
Examples
Key.byId('371460335192768546')!.replace({
role: "manager",
data: {
desc: "Manager user key for prod app database"
}
})
{
id: "371460335192768546",
coll: Key,
ts: Time("2099-07-28T02:25:07.910Z"),
role: "manager",
data: {
desc: "Manager user key for prod app database"
}
}
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!