voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
29 lines (17 loc) • 1.22 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) > [Transaction](./firestore_lite.transaction.md) > [set](./firestore_lite.transaction.set_1.md)
## Transaction.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): this;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| documentRef | [DocumentReference](./firestore_lite.documentreference.md)<!-- --><T> | A reference to the document to be set. |
| data | Partial<T> | 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>
this
This `Transaction` instance. Used for chaining method calls.