updateDoc
Updates fields in the document referred to by the specified
DocumentReference. The update will fail if applied to a document that does
not exist.
Note that the returned Promise does not resolve until the data is
successfully written to the remote Firestore backend and, similarly, is not
rejected until the remote Firestore backend reports an error saving the given
data. So if the client cannot reach the backend (for example, due to being
offline) then the returned Promise will not resolve for a potentially-long
time (for example, until the client has gone back online). That being said,
the given data will be immediately saved to the local cache and will be
incorporated into future "get" operations as if it had been successfully
written to the remote Firestore server, a feature of Firestore called
"latency compensation". The data will eventually be written to the remote
Firestore backend once a connection can be established. Therefore, it is
usually undesirable to await the Promise returned from this function
because the indefinite amount of time before which the promise resolves or
rejects can block application logic unnecessarily.
Updates fields in the document referred to by the specified
DocumentReference. The update will fail if applied to a document that does
not exist.
Note that the returned Promise does not resolve until the data is
successfully written to the remote Firestore backend and, similarly, is not
rejected until the remote Firestore backend reports an error saving the given
data. So if the client cannot reach the backend (for example, due to being
offline) then the returned Promise will not resolve for a potentially-long
time (for example, until the client has gone back online). That being said,
the given data will be immediately saved to the local cache and will be
incorporated into future "get" operations as if it had been successfully
written to the remote Firestore server, a feature of Firestore called
"latency compensation". The data will eventually be written to the remote
Firestore backend once a connection can be established. Therefore, it is
usually undesirable to await the Promise returned from this function
because the indefinite amount of time before which the promise resolves or
rejects can block application logic unnecessarily.
§Parameters
- A reference to the document to update.
- An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
Updates fields in the document referred to by the specified
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.
Note that the returned Promise does not resolve until the data is
successfully written to the remote Firestore backend and, similarly, is not
rejected until the remote Firestore backend reports an error saving the given
data. So if the client cannot reach the backend (for example, due to being
offline) then the returned Promise will not resolve for a potentially-long
time (for example, until the client has gone back online). That being said,
the given data will be immediately saved to the local cache and will be
incorporated into future "get" operations as if it had been successfully
written to the remote Firestore server, a feature of Firestore called
"latency compensation". The data will eventually be written to the remote
Firestore backend once a connection can be established. Therefore, it is
usually undesirable to await the Promise returned from this function
because the indefinite amount of time before which the promise resolves or
rejects can block application logic unnecessarily.
§Parameters
- A reference to the document to update.