Home > @firebase/firestore > lite > Transaction
Transaction class
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().
Signature:
export declare class Transaction
Methods
Method | Modifiers | Description |
---|---|---|
delete(documentRef) | Deletes the document referred to by the provided DocumentReference. | |
get(documentRef) | Reads the document referenced by the provided DocumentReference. | |
set(documentRef, data) | Writes to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. | |
set(documentRef, data, options) | 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. |
|
update(documentRef, data) | Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist. | |
update(documentRef, field, value, moreFieldsAndValues) | 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. |