Class Transaction


@InternalExtensionOnly public abstract class Transaction extends UpdateBuilder<Transaction>
A Transaction is passed to a Function to provide the methods to read and write data within the transaction context.
See Also:
  • Constructor Details

    • Transaction

      protected Transaction(com.google.cloud.firestore.FirestoreImpl firestore)
  • Method Details

    • className

      protected String className()
      Overrides:
      className in class UpdateBuilder<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

      @Nonnull public abstract com.google.api.core.ApiFuture<QuerySnapshot> get(@Nonnull Query query)
      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.