Class Transaction (3.17.0)

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: Firestore#runTransaction(Function)

Inheritance

java.lang.Object > UpdateBuilder > Transaction

Constructors

Transaction(FirestoreImpl firestore)

protected Transaction(FirestoreImpl firestore)
Parameter
NameDescription
firestorecom.google.cloud.firestore.FirestoreImpl

Methods

className()

protected String className()
Returns
TypeDescription
String
Overrides

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.

Parameter
NameDescription
queryAggregateQuery
Returns
TypeDescription
ApiFuture<AggregateQuerySnapshot>

The result of the aggregation.

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.

Parameter
NameDescription
documentRefDocumentReference
Returns
TypeDescription
ApiFuture<DocumentSnapshot>

The contents of the Document at this DocumentReference.

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
NameDescription
queryQuery
Returns
TypeDescription
ApiFuture<QuerySnapshot>

The contents of the Document at this DocumentReference.

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
NameDescription
documentReferencesDocumentReference[]

List of Document References to fetch.

Returns
TypeDescription
ApiFuture<List<DocumentSnapshot>>

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
NameDescription
documentReferencesDocumentReference[]

Array with Document References to fetch.

fieldMaskFieldMask

If set, specifies the subset of fields to return.

Returns
TypeDescription
ApiFuture<List<DocumentSnapshot>>

hasTransactionId()

public abstract boolean hasTransactionId()
Returns
TypeDescription
boolean