<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/firestore](./firestore.md) &gt; [lite](./firestore_lite.md) &gt; [WriteBatch](./firestore_lite.writebatch.md) &gt; [update](./firestore_lite.writebatch.update_1.md)

## WriteBatch.update() method

Updates fields in the document referred to by this [DocumentReference](./firestore_.documentreference.md)<!-- -->. The update will fail if applied to a document that does not exist.

Nested fields can be update by providing dot-separated field path strings or by providing `FieldPath` objects.

<b>Signature:</b>

```typescript
update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  documentRef | [DocumentReference](./firestore_lite.documentreference.md)<!-- -->&lt;unknown&gt; | A reference to the document to be updated. |
|  field | string \| [FieldPath](./firestore_lite.fieldpath.md) | The first field to update. |
|  value | unknown | The first value. |
|  moreFieldsAndValues | unknown\[\] | Additional key value pairs. |

<b>Returns:</b>

[WriteBatch](./firestore_lite.writebatch.md)

This `WriteBatch` instance. Used for chaining method calls.

