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
A transaction consists of any number of
get() operations followed by any number of write operations such as set(),
delete(). In the case of a concurrent edit, Cloud Firestore runs the entire transaction again. For example,
if a transaction reads documents and another client modifies any of those documents, Cloud Firestore retries the transaction.
This feature ensures that the transaction runs on up-to-date and consistent data.
Transactions never partially apply writes. All writes execute at the end of a successful transaction.
When using transactions, note that:
- Read operations must come before write operations.
- A function calling a transaction (transaction function) might run more than once if a concurrent edit affects a document that the transaction reads.
- Transaction functions should not directly modify application state (return a value from the
- Transactions will fail when the client is offline.
Deletes the document referred to by the provided
Reads the document referenced by the provided
Writes to the document referred to by the provided
DocumentReference. If the document does not exist yet,
it will be created. If you pass
SetOptions, the provided data can be merged into the existing document.
Updates fields in the document referred to by the provided
DocumentReference. The update will fail if applied
to a document that does not exist.
Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist.