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("412655134325080576")!.replace({
role: "server",
data: {
desc: "Server key for prod app database"
}
})
{
id: "412655134325080576",
coll: Key,
ts: Time("2099-07-28T02:25:07.910Z"),
role: "server",
data: {
desc: "Server 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!