credential.replace()

Replace a credential.

Signature

replace(object: {*: Any}) => <Credential>

Description

The replace() method replaces credentials with the object supplied. This method removes any fields not supplied by the object, with some exceptions. The immutable metadata fields coll and ts aren’t removed and can’t be replaced.

The object must include the required fields.

Parameters

Parameter Type Required Description

object

Object

Yes

Object with the replacement document fields.

Return value

Type Description

Document

Document with replaced fields.

Examples

Credential.byId("371240301830864930")!.replace({
  document: Customer.byId("370821615702769698"),
  password: "sekret"
})
{
  id: "371240301830864930",
  coll: Credential,
  ts: Time("2099-07-28T03:42:54.650Z"),
  document: Customer.byId("370821615702769698")
}

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!