The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > / > 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.