credential.update()

Update a credential.

Signature

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

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 are unchanged. Fields with nested objects in object are merged with the identically named nested object in the document.

Use the update() method to change the password associated with the credential.

To remove a field, set its value in object to null.

Parameters

Parameter Type Required Description

object

Object

Yes

Object with the updated document fields.

Return value

Type Description

Document

Document with updated fields.

Examples

Credential.byId("412654807560487424")!.update({
  password: "newest-sekret"
})
{
  id: "412654807560487424",
  coll: Credential,
  ts: Time("2099-08-14T23:50:22.420Z"),
  document: Customer("111")
}

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!