Accumulate write operations to be sent in a batch. Use this over
BulkWriteBatch for lower volumes or when the order of operations
within a given batch is important.
This has the same set of methods for write operations that
xref_DocumentReference does,
e.g. xref_create.
commit(retry:(google.api_core.retry.retry_unary.Retry|object|None)=_MethodDefault._DEFAULT_VALUE,timeout:typing.Optional[float]=None,)-> list
Commit the changes accumulated in this batch.
Parameters
Name
Description
retry
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. Defaults to a system-specified policy.
timeout
float
The timeout for this request. Defaults to a system-specified value.
Returns
Type
Description
List[WriteResult, ...]
The write results corresponding to the changes committed, returned in the same order as the changes were applied to this batch. A write result contains an update_time field.
[[["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 2025-08-07 UTC."],[],[],null,["# Class WriteBatch (2.21.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.21.0 (latest)](/python/docs/reference/firestore/latest/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.20.2](/python/docs/reference/firestore/2.20.2/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.19.0](/python/docs/reference/firestore/2.19.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.18.0](/python/docs/reference/firestore/2.18.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.17.2](/python/docs/reference/firestore/2.17.2/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.16.1](/python/docs/reference/firestore/2.16.1/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.15.0](/python/docs/reference/firestore/2.15.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.14.0](/python/docs/reference/firestore/2.14.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.13.1](/python/docs/reference/firestore/2.13.1/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.12.0](/python/docs/reference/firestore/2.12.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.11.1](/python/docs/reference/firestore/2.11.1/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.10.1](/python/docs/reference/firestore/2.10.1/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.9.1](/python/docs/reference/firestore/2.9.1/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.8.0](/python/docs/reference/firestore/2.8.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.7.3](/python/docs/reference/firestore/2.7.3/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.6.1](/python/docs/reference/firestore/2.6.1/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.5.3](/python/docs/reference/firestore/2.5.3/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.4.0](/python/docs/reference/firestore/2.4.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.3.4](/python/docs/reference/firestore/2.3.4/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.2.0](/python/docs/reference/firestore/2.2.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.1.3](/python/docs/reference/firestore/2.1.3/google.cloud.firestore_v1.batch.WriteBatch)\n- [2.0.2](/python/docs/reference/firestore/2.0.2/google.cloud.firestore_v1.batch.WriteBatch)\n- [1.9.2](/python/docs/reference/firestore/1.9.2/google.cloud.firestore_v1.batch.WriteBatch)\n- [1.8.1](/python/docs/reference/firestore/1.8.1/google.cloud.firestore_v1.batch.WriteBatch)\n- [1.7.0](/python/docs/reference/firestore/1.7.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [1.6.2](/python/docs/reference/firestore/1.6.2/google.cloud.firestore_v1.batch.WriteBatch)\n- [1.5.0](/python/docs/reference/firestore/1.5.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [1.4.0](/python/docs/reference/firestore/1.4.0/google.cloud.firestore_v1.batch.WriteBatch)\n- [1.3.0](/python/docs/reference/firestore/1.3.0/google.cloud.firestore_v1.batch.WriteBatch) \n\n WriteBatch(client)\n\nAccumulate write operations to be sent in a batch. Use this over\n`BulkWriteBatch` for lower volumes or when the order of operations\nwithin a given batch is important.\n\nThis has the same set of methods for write operations that\nxref_DocumentReference does,\ne.g. xref_create.\n\nMethods\n-------\n\n### commit\n\n commit(\n retry: (\n google.api_core.retry.retry_unary.Retry | object | None\n ) = _MethodDefault._DEFAULT_VALUE,\n timeout: typing.Optional[float] = None,\n ) -\u003e list\n\nCommit the changes accumulated in this batch."]]