Skip to content

Adding documentation for WriteBatch size limit #1715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/firebase/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6031,6 +6031,11 @@ declare namespace firebase.firestore {
* 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, but
* note that each usage of `FieldValue.serverTimestamp()`,
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
* `FieldValue.increment()` inside a transaction counts as an additional write.
*
* @param updateFunction
* The function to execute within the transaction context.
*
Expand All @@ -6047,7 +6052,10 @@ declare namespace firebase.firestore {

/**
* Creates a write batch, used for performing multiple writes as a single
* atomic operation.
* atomic operation. The maximum number of writes allowed in a single WriteBatch
* is 500, but note that each usage of `FieldValue.serverTimestamp()`,
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
* `FieldValue.increment()` inside a WriteBatch counts as an additional write.
*
* @return
* A `WriteBatch` that can be used to atomically execute multiple writes.
Expand Down
16 changes: 14 additions & 2 deletions packages/firestore-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,14 @@ export class FirebaseFirestore {
* transaction has changed, the updateFunction will be retried. If it fails
* to commit after 5 attempts, the transaction will fail.
*
* The maximum number of writes allowed in a single transaction is 500, but
* note that each usage of `FieldValue.serverTimestamp()`,
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
* `FieldValue.increment()` inside a transaction counts as an additional write.
*
* @param updateFunction The function to execute within the transaction
* context.
*
* @return If the transaction completed successfully or was explicitly
* aborted (by the updateFunction returning a failed Promise), the Promise
* returned by the updateFunction will be returned here. Else if the
Expand All @@ -206,8 +212,14 @@ export class FirebaseFirestore {
): Promise<T>;

/**
* Creates a write batch, used for performing multiple writes as a single
* atomic operation.
* Creates a write batch, used for performing multiple writes as a single
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, thanks for bringing this into sync.

* atomic operation. The maximum number of writes allowed in a single WriteBatch
* is 500, but note that each usage of `FieldValue.serverTimestamp()`,
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
* `FieldValue.increment()` inside a WriteBatch counts as an additional write.
*
* @return
* A `WriteBatch` that can be used to atomically execute multiple writes.
*/
batch(): WriteBatch;

Expand Down