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
Fields inherited from class com.google.cloud.firestore.UpdateBuilder
committed -
Method Summary
Modifier and TypeMethodDescriptioncom.google.api.core.ApiFuture<AggregateQuerySnapshot>get(AggregateQuery query) Returns the result from the provided aggregate query.com.google.api.core.ApiFuture<DocumentSnapshot>get(DocumentReference documentRef) Reads the document referred to by the provided DocumentReference.com.google.api.core.ApiFuture<QuerySnapshot>Returns the result set from the provided query.com.google.api.core.ApiFuture<List<DocumentSnapshot>>getAll(DocumentReference... documentReferences) Retrieves multiple documents from Firestore.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.boolean
-
Method Details
-
hasTransactionId
public boolean hasTransactionId() -
get
@Nonnull public 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 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 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 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.
-