Skip to content

Commit 721ac1c

Browse files
author
Brian Chen
authored
Adding documentation for batch() and runTransaction() size limit (#1715)
1 parent e641edd commit 721ac1c

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

packages/firebase/index.d.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -6031,6 +6031,11 @@ declare namespace firebase.firestore {
60316031
* has changed, Cloud Firestore retries the `updateFunction`. If it fails to
60326032
* commit after 5 attempts, the transaction fails.
60336033
*
6034+
* The maximum number of writes allowed in a single transaction is 500, but
6035+
* note that each usage of `FieldValue.serverTimestamp()`,
6036+
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
6037+
* `FieldValue.increment()` inside a transaction counts as an additional write.
6038+
*
60346039
* @param updateFunction
60356040
* The function to execute within the transaction context.
60366041
*
@@ -6047,7 +6052,10 @@ declare namespace firebase.firestore {
60476052

60486053
/**
60496054
* Creates a write batch, used for performing multiple writes as a single
6050-
* atomic operation.
6055+
* atomic operation. The maximum number of writes allowed in a single WriteBatch
6056+
* is 500, but note that each usage of `FieldValue.serverTimestamp()`,
6057+
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
6058+
* `FieldValue.increment()` inside a WriteBatch counts as an additional write.
60516059
*
60526060
* @return
60536061
* A `WriteBatch` that can be used to atomically execute multiple writes.

packages/firestore-types/index.d.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,14 @@ export class FirebaseFirestore {
193193
* transaction has changed, the updateFunction will be retried. If it fails
194194
* to commit after 5 attempts, the transaction will fail.
195195
*
196+
* The maximum number of writes allowed in a single transaction is 500, but
197+
* note that each usage of `FieldValue.serverTimestamp()`,
198+
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
199+
* `FieldValue.increment()` inside a transaction counts as an additional write.
200+
*
196201
* @param updateFunction The function to execute within the transaction
197202
* context.
203+
*
198204
* @return If the transaction completed successfully or was explicitly
199205
* aborted (by the updateFunction returning a failed Promise), the Promise
200206
* returned by the updateFunction will be returned here. Else if the
@@ -206,8 +212,14 @@ export class FirebaseFirestore {
206212
): Promise<T>;
207213

208214
/**
209-
* Creates a write batch, used for performing multiple writes as a single
210-
* atomic operation.
215+
* Creates a write batch, used for performing multiple writes as a single
216+
* atomic operation. The maximum number of writes allowed in a single WriteBatch
217+
* is 500, but note that each usage of `FieldValue.serverTimestamp()`,
218+
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
219+
* `FieldValue.increment()` inside a WriteBatch counts as an additional write.
220+
*
221+
* @return
222+
* A `WriteBatch` that can be used to atomically execute multiple writes.
211223
*/
212224
batch(): WriteBatch;
213225

0 commit comments

Comments
 (0)