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. |
token.update()
Update a token.
Description
The update()
method updates the document with the object fields
and returns the updated document. During the update, fields from object
are copied to the document, creating new fields or updating existing
fields. The operation is similar to a merge.
Only the fields included in object are updated, all other document fields aren’t updated. Fields with nested objects in object are merged with the identically named nested object in the document.
Use the update()
method to rename a token or update its user-defined
metadata.
To remove a document field, Set its value in object to null
. Deleted
fields aren’t saved.
Examples
Token.byId("401670938431586381")!.update({
data: {
clientIpAddr: "123.123.12.1"
}
})
{
id: "401670938431586381",
coll: Token,
ts: Time("2099-07-28T03:21:08.580Z"),
document: Customer("111"),
data: {
clientIpAddr: "123.123.12.1"
}
}
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!