Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

runTransaction

Executes the given updateFunction and then attempts to commit the changes applied within the transaction. If any document read within the transaction has changed, Cloud Firestore retries the updateFunction. If it fails to commit after 5 attempts, the transaction fails.

The maximum number of writes allowed in a single transaction is 500.

function runTransaction<T>(
firestore: Firestore,
updateFunction: (transaction: Transaction) => Promise<T>,
): Promise<T>;
§
runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>
[src]

§Type Parameters

§Parameters

§
firestore: Firestore
[src]
  • A reference to the Firestore database to run this transaction against.
§
updateFunction: (transaction: Transaction) => Promise<T>
[src]
  • The function to execute within the transaction context.
§
options?: TransactionOptions optional
[src]
  • An options object to configure maximum number of attempts to commit.

§Return Type

§
Promise<T>
[src]

If the transaction completed successfully or was explicitly aborted (the updateFunction returned a failed promise), the promise returned by the updateFunction is returned here. Otherwise, if the transaction failed, a rejected promise with the corresponding failure error is returned.