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 > / > 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.

Signature:

update(documentRef: DocumentReference<unknown>, data: UpdateData): this;

Parameters

Parameter Type Description
documentRef DocumentReference<unknown> A reference to the document to be updated.
data UpdateData An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.

Returns:

this

This Transaction instance. Used for chaining method calls.