token.replace()

Replace a token.

Signature

replace(object: {*: Any}) => <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

Object

Yes

Object with the replacement document fields.

Return value

Type Description

Document

Document with replaced fields.

Examples

Token.byId("371233004820889634")!.replace({
  document: Customer.byId("370723013175279650")
})
{
  id: "371233004820889634",
  coll: Token,
  ts: Time("2099-07-28T03:24:23.810Z"),
  document: Customer.byId("370723013175279650")
}

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!