<!-- 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; [set](./firestore_lite.writebatch.set_1.md)

## WriteBatch.set() method

Writes to the document referred to by the provided [DocumentReference](./firestore_.documentreference.md)<!-- -->. If the document does not exist yet, it will be created. If you provide `merge` or `mergeFields`<!-- -->, the provided data can be merged into an existing document.

<b>Signature:</b>

```typescript
set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): WriteBatch;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  documentRef | [DocumentReference](./firestore_lite.documentreference.md)<!-- -->&lt;T&gt; | A reference to the document to be set. |
|  data | Partial&lt;T&gt; | An object of the fields and values for the document. |
|  options | [SetOptions](./firestore_lite.setoptions.md) | An object to configure the set behavior. |

<b>Returns:</b>

[WriteBatch](./firestore_lite.writebatch.md)

This `WriteBatch` instance. Used for chaining method calls.

