Firetool

Home / Docs / Check data

Docs

Find duplicates, broken references and mixed types in Firestore

Check data looks for common problems in the documents a query matches, tells you what it will read before it starts, and lists each problem with the documents to open. It never changes anything. From version 4.2.

Run a check

  1. Open a collection and run the query whose documents you want to check (with no filter, that's the whole collection).
  2. Choose Actions ▾ → Check data….
  3. Tick what to look for:
    • Duplicate values in a field you choose, such as email: documents that share the same value. It's an exact match: "Ada" and "ada" are different.
    • References to missing documents in one reference field, or in every reference field: references that point at documents that don't exist, such as an order whose customer was deleted.
    • Fields with more than one type: a field that's a number in most documents and text in a few, including fields inside maps.
  4. Choose how many documents to check: 1,000, 10,000, 100,000 or every matching document. Firetool counts them first and says what the check will read; a reference check also reads each referenced document once. Checking more than 10,000 asks first.
  5. Choose Run check. It runs as a task, so Tasks shows how far it is, and you can pause or cancel it.

Each document read is a Firestore read, billed like any other. Nothing is written.

Read the results

The dialog lists what it found, in plain words: for duplicates, each shared value and the documents that have it; for references, each missing document and the documents that point at it; for types, each field with how many documents hold each type. Click a document to open it. References to another project or database are counted but not looked up.

Check data in Firetool: 2 problems in 15 customers, an email shared by two documents and a lifetime value stored as text in one

Save the report

Save report (JSON) keeps everything the check found. Save problems (CSV) writes one line per finding (the check, the field, the value or type, how many documents, and the documents), for a spreadsheet.

Run it in CI

Use in CI… shows the firetool command that runs the same check, for example:

firetool check my-project customers --duplicates email --references '*' --types --limit 10000

It prints what it found and ends with exit code 6 when it finds problems (0 when it doesn't), so a CI step fails. --json prints the report; --where narrows the documents like a query. In CI, give it a key for the run with --key-file.

Questions

Does Check data change my documents?

No. It only reads: the documents the query matches and, for the reference check, each referenced document once. Fixing what it finds is up to you, for example with Set a value in documents or by editing the documents it lists.

How is this different from the Schema tab?

The Schema tab compares documents with an expected schema you saved: fields of another type, missing required fields and fields not expected. Check data needs no saved schema and also finds duplicate values and references to missing documents.

Does it need Pro?

Checking reads data, which works in the Free edition. Fixing what it finds (changing documents) needs Pro.