Data Operations

Bulk Update Firestore Documents

The bulk update feature is accessible from Tools -> Update Documents. This functionality allows you to efficiently modify multiple documents at once by deleting, creating, updating, or renaming fields.

Process Overview

The bulk update process consists of two steps:

  1. Filter Documents: Configure a query to select the documents to update.
  2. Define the changes to be applied to the selected documents.

Available Actions

When updating documents, you can perform the following actions on fields:

  • Delete a field
  • Create a new field
  • Update an existing field
  • Rename a field

Each action is configurable for specific fields in your documents.

Configuring Bulk Updates

1. Delete a Field

Removes a specified field from all selected documents.

Delete attribute

  • Configuration: Select Delete attribute and specify the field name to remove.

2. Create a New Field

Adds a new field to all selected documents.

Create attribute

  • Configuration: Select Create attribute, specify the field name, and choose a value type: (see Value Types)
    • Static value
    • Dynamic value
    • Value set based on another field
    • Converted value
    • Embedding
    • Custom script

3. Update an Existing Field

Modifies the value of an existing field across selected documents.

Update attribute

  • Configuration: Select Update attribute, specify the field name, and choose how the value should be updated: (see Value Types)
    • Static value
    • Dynamic value
    • Value set based on another field
    • Converted value
    • Embedding
    • Custom script
  • Optionally, enable Create attribute if it does not exist to ensure the field is added if missing.

4. Rename a Field

Changes the name of a field in all selected documents.

Rename attribute

  • Configuration: Select Rename attribute, specify the old name, and enter the new field name.

Value Types

When setting or updating a field, the following value types are available:

  • Static: Assign a fixed value.
  • Dynamic: Generate values dynamically from a predefined set.
  • Other Field: Use the value of another field.
  • Convert: Transform the existing value to a different format.
  • Embedding - Generate vector embeddings for text fields using AI models for semantic search and similarity operations
  • Custom script: Compute the new value with your own JavaScript, executed inside the app (see Custom Script below).

Dynamic Values

The following dynamic values are available for field updates:

  • Increment
  • Array modifications (add or remove values)
  • Minimum or maximum values
  • Timestamps (creation, update, server time)
  • Unique identifiers (UUID, KSUID, Firebase ID)
  • Random number generation

Convert Functions

If converting a value, the following transformations are available:

  • Convert to integer, float, or string
  • String transformations (e.g., lowercase, uppercase, capitalize, camel case, kebab case, pascal case, snake case, screaming snake case, swap case)
  • Convert to boolean
  • Convert to timestamp (various formats)
  • Convert to geographic point or hash
  • Convert to reference
  • Use custom function (write the conversion yourself in JavaScript)

Use Custom Function

When Use custom function is selected, the conversion is defined by a script you write. The script receives the current field value as the value global — alongside doc, field and the common globals described in the Custom Scripts reference — and returns the converted value:

// Parse "12,50" style prices into numbers
if (typeof value !== 'string') return undefined;
return parseFloat(value.replace(',', '.'));

Return undefined to mark the value as not converted: the error handling policy below then decides what happens, exactly as for the built-in conversions.


Handling Conversion Errors

When converting values, the following options define how errors are managed:

  • null: Replace with null
  • skip: Ignore the update for that document
  • fail: Stop execution
  • delete: Remove the field

Custom Script

With the Custom script value type you compute the new value yourself in JavaScript. The script runs inside the app, once per matching document, and returns the new value for the target field.

The script receives:

  • doc — the current document, with a DocumentSnapshot-like surface: doc.id, doc.exists, doc.ref, doc.data(), doc.get('a.b'), and doc.createTime / doc.updateTime / doc.readTime as Date
  • field — the path of the field being updated
  • the common globals — db, database(), fetch, util, the object helpers get / pick / omit, GeoPoint, FieldValue, … — described in the Custom Scripts reference

Scripts are written as a body — statements plus a top-level return — and await is allowed:

// Normalize an email field
const data = doc.data();
if (!data.email) return FieldValue.delete();
return data.email.trim().toLowerCase();

A few rules specific to this flow:

  • Return undefined to leave the document unchanged.
  • FieldValue.delete() removes the field, and FieldValue.serverTimestamp() writes the server time.
  • The If the script fails on a document setting controls the error policy: Skip the document and continue (the default — failures are counted and listed in the job details with the document path and the error message) or Stop the job.

Scripts can be saved with Save to library and reloaded later with Load script…. See the full Custom Scripts reference for all globals, the value conversion rules and the limits.

Applying Bulk Updates

Once the desired modifications are configured, click Confirm to apply the changes to all matching documents in Firestore.

This feature enables efficient and scalable document updates, reducing manual intervention while ensuring data consistency.

Important Notice

The modification process is irreversible.

Please review your configurations carefully before applying changes. Undefined values, when converted to a string or number, will default to empty values such as "" or 0.