voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
28 lines (16 loc) • 1.2 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/firestore](./firestore.md) > [lite](./firestore_lite.md) > [WriteBatch](./firestore_lite.writebatch.md) > [update](./firestore_lite.writebatch.update.md)
## WriteBatch.update() method
Updates fields in the document referred to by the provided [DocumentReference](./firestore_.documentreference.md)<!-- -->. The update will fail if applied to a document that does not exist.
<b>Signature:</b>
```typescript
update(documentRef: DocumentReference<unknown>, data: UpdateData): WriteBatch;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| documentRef | [DocumentReference](./firestore_lite.documentreference.md)<!-- --><unknown> | A reference to the document to be updated. |
| data | [UpdateData](./firestore_lite.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>
[WriteBatch](./firestore_lite.writebatch.md)
This `WriteBatch` instance. Used for chaining method calls.