voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
28 lines (16 loc) • 1.15 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/firestore](./firestore.md) > [/](./firestore_.md) > [updateDoc](./firestore_.updatedoc.md)
## 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.
<b>Signature:</b>
```typescript
export declare function updateDoc(reference: DocumentReference<unknown>, data: UpdateData): Promise<void>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| reference | [DocumentReference](./firestore_.documentreference.md)<!-- --><unknown> | A reference to the document to update. |
| data | [UpdateData](./firestore_.updatedata.md) | An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document. |
<b>Returns:</b>
Promise<void>
A Promise resolved once the data has been successfully written to the backend (note that it won't resolve while you're offline).