Firebase Admin icon

Firebase Admin

Interact with Firebase Firestore, Auth, and Storage using Firebase Admin SDK

Firestore → Batch Write

AI-generated

Summary

Execute multiple Firestore document operations atomically in a single batch write, ensuring all succeed or fail together.

Inputs

  • Batch Operations (required) — A JSON array defining batch operations. Each item specifies an operationType (create, set, update, delete), documentPath, documentData (optional for delete), and for set operations, an optional merge flag to control merging.

Output shape

A single response object representing the result of the batch write operation.

Supports up to 500 operations per batch. The operation is atomic; either all operations succeed or none are applied.

Examples

Example 1: Create multiple documents and update others in one atomic batch write

Provide a JSON array with operations such as create with document data for a collection path, set with merge options for specific document paths, update with new fields, and delete for removal of documents.

Links

Discussion