Home > @firebase/firestore > lite > Transaction > set
Transaction.set() method
Writes to the document referred to by the provided DocumentReference. 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.
Signature:
set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): this;
Parameters
Parameter | Type | Description |
---|---|---|
documentRef | DocumentReference<T> | A reference to the document to be set. |
data | Partial<T> | An object of the fields and values for the document. |
options | SetOptions | An object to configure the set behavior. |
Returns:
this
This Transaction
instance. Used for chaining method calls.