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.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("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!