Package com.google.cloud.firestore
Class Transaction
A Transaction is passed to a Function to provide the methods to read and write data within the
transaction context.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceUser callback that takes a Firestore Async Transaction.static interfaceUser callback that takes a Firestore Transaction. -
Field Summary
FieldsFields inherited from class com.google.cloud.firestore.UpdateBuilder
committed -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransaction(com.google.cloud.firestore.FirestoreImpl firestore) -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringabstract com.google.api.core.ApiFuture<AggregateQuerySnapshot>get(AggregateQuery query) Returns the result from the provided aggregate query.abstract com.google.api.core.ApiFuture<DocumentSnapshot>get(DocumentReference documentRef) Reads the document referred to by the provided DocumentReference.abstract com.google.api.core.ApiFuture<QuerySnapshot>Returns the result set from the provided query.abstract com.google.api.core.ApiFuture<List<DocumentSnapshot>>getAll(DocumentReference... documentReferences) Retrieves multiple documents from Firestore.abstract com.google.api.core.ApiFuture<List<DocumentSnapshot>>getAll(DocumentReference[] documentReferences, FieldMask fieldMask) Retrieves multiple documents from Firestore, while optionally applying a field mask to reduce the amount of data transmitted from the backend.abstract boolean
-
Field Details
-
transactionTraceContext
-
-
Constructor Details
-
Transaction
protected Transaction(com.google.cloud.firestore.FirestoreImpl firestore)
-
-
Method Details
-
className
- Overrides:
classNamein classUpdateBuilder<Transaction>
-
hasTransactionId
public abstract boolean hasTransactionId() -
get
@Nonnull public abstract com.google.api.core.ApiFuture<DocumentSnapshot> get(@Nonnull DocumentReference documentRef) Reads the document referred to by the provided DocumentReference. Holds a pessimistic lock on the returned document.- Returns:
- The contents of the Document at this DocumentReference.
-
getAll
@Nonnull public abstract com.google.api.core.ApiFuture<List<DocumentSnapshot>> getAll(@Nonnull DocumentReference... documentReferences) Retrieves multiple documents from Firestore. Holds a pessimistic lock on all returned documents.- Parameters:
documentReferences- List of Document References to fetch.
-
getAll
@Nonnull public abstract com.google.api.core.ApiFuture<List<DocumentSnapshot>> getAll(@Nonnull DocumentReference[] documentReferences, @Nullable FieldMask fieldMask) Retrieves multiple documents from Firestore, while optionally applying a field mask to reduce the amount of data transmitted from the backend. Holds a pessimistic lock on all returned documents.- Parameters:
documentReferences- Array with Document References to fetch.fieldMask- If set, specifies the subset of fields to return.
-
get
Returns the result set from the provided query. Holds a pessimistic lock on all returned documents.- Returns:
- The contents of the Document at this DocumentReference.
-
get
@Nonnull public abstract com.google.api.core.ApiFuture<AggregateQuerySnapshot> get(@Nonnull AggregateQuery query) Returns the result from the provided aggregate query. Holds a pessimistic lock on all accessed documents.- Returns:
- The result of the aggregation.
-