The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > lite > Transaction > update

Transaction.update() method

Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist.

Nested fields can be updated by providing dot-separated field path strings or by providing FieldPath objects.

Signature:

update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this;

Parameters

Parameter Type Description
documentRef DocumentReference<unknown> A reference to the document to be updated.
field string | FieldPath The first field to update.
value unknown The first value.
moreFieldsAndValues unknown[] Additional key/value pairs.

Returns:

this

This Transaction instance. Used for chaining method calls.