Transaction
A reference to a transaction.
The Transaction
object passed to a transaction's updateFunction
provides
the methods to read and write data within the transaction context. See
runTransaction.
§Methods
Deletes the document referred to by the provided DocumentReference.
- A reference to the document to be deleted.
This Transaction
instance. Used for chaining method calls.
Reads the document referenced by the provided DocumentReference.
- A reference to the document to be read.
A DocumentSnapshot
with the read data.
Writes to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created.
- A reference to the document to be set.
- An object of the fields and values for the document.
This Transaction
instance. Used for chaining method calls.
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.
- A reference to the document to be set.
- An object of the fields and values for the document.
- An object to configure the set behavior.
This Transaction
instance. Used for chaining method calls.
Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist.
- A reference to the document to be updated.
- An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
This Transaction
instance. Used for chaining method calls.
Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist.
Nested fields can be updated by providing dot-separated field path
strings or by providing FieldPath
objects.
- A reference to the document to be updated.
- The first field to update.
- The first value.
- Additional key/value pairs.
This Transaction
instance. Used for chaining method calls.