<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/firestore](./firestore.md) &gt; [/](./firestore_.md) &gt; [updateDoc](./firestore_.updatedoc_1.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.

Nested fields can be updated by providing dot-separated field path strings or by providing `FieldPath` objects.

<b>Signature:</b>

```typescript
export declare function updateDoc(reference: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  reference | [DocumentReference](./firestore_.documentreference.md)<!-- -->&lt;unknown&gt; | A reference to the document to update. |
|  field | string \| [FieldPath](./firestore_.fieldpath.md) | The first field to update. |
|  value | unknown | The first value. |
|  moreFieldsAndValues | unknown\[\] | Additional key value pairs. |

<b>Returns:</b>

Promise&lt;void&gt;

A Promise resolved once the data has been successfully written to the backend (note that it won't resolve while you're offline).

