Send feedback
Class Transaction (3.36.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version latestkeyboard_arrow_down
public abstract class Transaction extends UpdateBuilder<Transaction>
Constructors
Transaction(FirestoreImpl firestore)
protected Transaction ( FirestoreImpl firestore )
Parameter
Name
Description
firestore
com.google.cloud.firestore.FirestoreImpl
Fields
transactionTraceContext
protected TraceUtil . Context transactionTraceContext
Methods
className()
protected String className ()
Returns
Type
Description
String
Overrides
execute(Pipeline pipeline)
public abstract ApiFuture<Pipeline . Snapshot > execute ( Pipeline pipeline )
Beta
This feature is covered by the Pre-GA Offerings Terms of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.
Executes the provided pipeline within the transaction context.
Parameter
Name
Description
pipeline
Pipeline
execute(Pipeline pipeline, PipelineExecuteOptions options)
public abstract ApiFuture<Pipeline . Snapshot > execute ( Pipeline pipeline , PipelineExecuteOptions options )
Beta
This feature is covered by the Pre-GA Offerings Terms of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.
Executes the provided pipeline with specified options, within the transaction context.
get(AggregateQuery query)
public abstract ApiFuture<AggregateQuerySnapshot> get ( AggregateQuery query )
Returns the result from the provided aggregate query. Holds a pessimistic lock on all accessed
documents.
get(DocumentReference documentRef)
public abstract ApiFuture<DocumentSnapshot> get ( DocumentReference documentRef )
Reads the document referred to by the provided DocumentReference. Holds a pessimistic lock on
the returned document.
get(Query query)
public abstract ApiFuture<QuerySnapshot> get ( Query query )
Returns the result set from the provided query. Holds a pessimistic lock on all returned
documents.
Parameter
Name
Description
query
Query
getAll(DocumentReference[] documentReferences)
public abstract ApiFuture<List<DocumentSnapshot> > getAll ( DocumentReference [] documentReferences )
Retrieves multiple documents from Firestore. Holds a pessimistic lock on all returned
documents.
Parameter
Name
Description
documentReferences
DocumentReference []List of Document References to fetch.
getAll(DocumentReference[] documentReferences, FieldMask fieldMask)
public abstract 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. Holds a pessimistic lock on all returned
documents.
Parameters
Name
Description
documentReferences
DocumentReference []Array with Document References to fetch.
fieldMask
FieldMask If set, specifies the subset of fields to return.
hasTransactionId()
public abstract boolean hasTransactionId ()
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-01 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-02-01 UTC."],[],[]]