The Schema tab only reads. It works in the Free edition.
Open the Schema tab
- Right-click a collection in the sidebar and choose Schema…, or, with the collection open, choose Actions ▾ → Schema…. The command palette (Ctrl+K) finds it too.
- Choose how many documents to sample: from the first 100 up to 10,000, by document ID. Each document is one read. Over 10,000 reads, Firetool asks first and shows the estimated cost.
- The schema appears in its own tab.
Read the schema
Each field of the sampled documents has a row with:
- its types (text, number, timestamp, map, array, reference and so on) and how often it appears, as a percentage of the sample;
- the fields of a map under it, such as
address.city, and the types of the items in an array; - a few example values;
- a mixed flag when documents disagree on the field's type, such as a price that's a number in most documents and text in a few.
Save the expected schema
When the schema looks right, choose Save as expected. It's kept on this computer as the collection's expected schema. The next time you read a sample, Firetool shows what changed since: new fields, fields it no longer sees, type changes, and fields that are no longer in every document.
Backups of a whole database can include Firetool's settings, so expected schemas travel with them. See Backup and restore.
Check documents
With an expected schema saved, choose Check documents. Firetool lists the sampled documents that don't match, and why: a field with the wrong type, a field that's missing, or a field that isn't in the schema. Click one to open the document.
Export JSON Schema
JSON Schema… writes the schema as JSON Schema (draft 2020-12), describing documents in the form Firetool's JSON export writes them. Copy it or save it as a file, for example to check data in your own tests.
Questions
Does Firetool read the whole collection?
No. It reads the sample you choose, the first documents by ID. A field that only appears in documents outside the sample won't show. Choose a bigger sample for a fuller picture; each document is one read.
Does saving an expected schema change my database?
No. The expected schema is kept in Firetool on this computer. Firestore doesn't enforce it; it's only used to show changes and to check documents.
Related
- Firestore GUI: everything Firetool does with your data.
- Query Firestore: find the documents the check lists.
- Bulk field changes: fix a field's type in every matching document.
- Export: the JSON form the JSON Schema describes.