Firetool

Home / Docs / Bulk field changes

Docs

Set, rename or delete a field in many Firestore documents

Change one field in every document a query matches: set a value, rename the field or delete it. You see a preview before anything is written, and you can stop and resume the job. Needs Firetool Pro.

Run the query first

  1. Open the collection and add filters for the documents you want to change, for example status == trial.
  2. Choose Run. The job uses the query of your last Run, not filters you've typed since, so run it again after any change.
  3. Right-click the header of the column you want to change. The menu has Set a value in documents…, Rename field in documents… and Delete field from documents….

Each dialog lets you choose Every document matching this query or Selected rows. "Every document" means everything the query matches, not only the rows on screen. In a JS Query tab, only Selected rows is available.

These items show Pro and are greyed out in the Free edition. They're also off if your role for the project is Viewer or the project is marked read-only.

Set a value in documents

  1. Field starts as the column you clicked. Type another name to add a new field. Use dots for a field inside a map, such as address.city; the rest of the map is kept.
  2. Choose the Type:
    TypeWhat to enter
    AutoFiretool works out the type from what you type.
    TextAny text, kept as a string, even if it looks like a number.
    NumberA number. Long whole numbers are kept as exact 64-bit integers.
    True / falsetrue for true; anything else is false.
    NullNothing: the value is null.
    TimestampA date and time, such as 2026-10-01T00:00:00Z.
    ReferenceA document path, such as users/alice.
    JSON (map or array)A JSON value, such as {"plan": "pro", "seats": 5} or ["a", "b"].
  3. Enter the Value.
  4. Tick Only documents that don't have this field yet to fill in a missing field without touching documents that already have it.

Documents that already hold exactly that value, with the same type, aren't written.

Rename field in documents

  1. Type the New name. Use dots to move the field into a map, such as address.town. The value moves as it is, with its type.
  2. Under If a document already has the new name, choose Leave that document as it is or Replace its value.

Documents that don't have the field are skipped. A field can't be renamed into itself or into the map it's in.

Delete field from documents

Choose the scope and preview. Only that field is removed; the rest of each document stays. Documents without the field are skipped.

Preview, then apply

  1. Choose Preview. Nothing is written yet. Firetool first counts the matching documents; if there are more than 10,000, it shows the number of reads and asks before going on.
  2. The preview says how many documents will change and why the others won't (they don't have the field, already have the value, or already have the new name). It also says how many writes that is and how many documents the preview read.
  3. A table shows up to five documents with the field before and after.
  4. Choose the button that names the change, such as Set in 1,240 documents, Rename in … or Delete in ….

Changing anything in the dialog clears the preview, so what you apply is always what you previewed.

Firetool writes in batches of 500 and shows how many have changed. Cancel stops after the current batch; the button then reads Resume and continues where it stopped. When it's done, the tab runs the query again so you see the result.

How the writes stay safe

  • Only the changed field is sent. Each write names just that field (and, for a rename, the new one), so other fields aren't overwritten.
  • Documents changed since the preview are skipped. Every write carries the document's last update time from the preview. If someone changed or deleted the document since, Firestore refuses that write, and Firetool counts it as "skipped (changed after the preview)". Preview again to include them.
  • Busy errors are retried. Writes that fail only because Firestore is busy are sent again with a pause.
  • Production asks first. If the project or database is marked production, you type the project ID once before the job writes.
  • Rules apply. Read-only collections, required reasons and the audit log apply as for any change. The job also appears in Tools → Tasks with the reads and writes it cost.

Undo a change

For Set, Rename and Delete field, Firetool keeps a copy of each document as it was before the change in the audit log, unless your policy turns copies off. Open Tools → Audit log, click an entry for the job (one per batch) and choose Restore N documents. That writes the old versions back, replacing any changes made since.

The same change with a JS Query

For a change the dialogs don't cover, such as working out each new value from other fields, use a JS Query (also Pro). A batch holds at most 500 writes:

// Move trial users to the free plan and remove an old field
const snap = await db.collection("users")
  .where("plan", "==", "trial")
  .limit(500)
  .get();
const batch = db.batch();
snap.forEach((doc) => batch.update(doc.ref, {
  plan: "free",
  legacyFlag: FieldValue.delete(),
}));
await batch.commit();
return `${snap.size} documents updated`;

Run it again until it reports 0. A script has no preview and doesn't check whether a document changed since it was read, so try it on a test project first. In a production project you type the project ID before a script runs.

Questions

Can I change a field inside a map?

Yes. Use dots in the field name, such as address.city. For Set, the other fields in the map are kept. For Rename, you can also move a field into or out of a map.

What if the job stops halfway?

The documents already changed stay changed. Choose Resume to continue with the rest of the same preview. Documents edited by someone else in the meantime are skipped, not overwritten.