Home > @firebase/firestore > lite > updateDoc
updateDoc() function
Updates fields in the document referred to by the specified DocumentReference
. The update will fail if applied to a document that does not exist.
The result of this update will only be reflected in document reads that occur after the returned Promise resolves. If the client is offline, the update fails. If you would like to see local modifications or buffer writes until the client is online, use the full Firestore SDK.
Signature:
export declare function updateDoc(reference: DocumentReference<unknown>, data: UpdateData): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
reference | DocumentReference<unknown> | A reference to the document to update. |
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:
Promise<void>
A Promise resolved once the data has been successfully written to the backend.