token.replace()
Replace a token.
Description
The replace()
method replaces all fields with object, except
for the immutable metadata fields id
, coll
, and ts
. Fields not
present in object, except immutable metadata fields, are removed
from the document.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
object |
Yes |
Object with the replacement document fields. |
Examples
Token.byId("401670938431586381")!.replace({
document: Customer.byId("222")
})
{
id: "401670938431586381",
coll: Token,
ts: Time("2099-07-28T03:24:23.810Z"),
document: Customer("222")
}
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!