credential.update()

Update a credential.

Signature

update(data: { *: Any }) => Credential

Description

Updates a Credential document with fields from a provided data object.

During the update, fields from the data object are copied to the document, creating new fields or updating existing fields. The operation is similar to a merge.

Nested fields

Fields with nested objects in the data object are merged with the identically named nested object in the document.

Remove a field

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

Metadata fields

You can’t use this method to insert or edit the following metadata fields:

  • coll

  • ts

Parameters

Parameter Type Required Description

data

Object

Yes

Document fields for the Credential document.

For supported document fields, see Credential collection.

The object can’t include the following metadata fields:

* coll * ts

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!