Everything on this page works in the Free edition, except creating and deleting composite indexes, which needs Pro.
Open a collection
- In the sidebar, expand your account and project. If the project has more than one database, expand the database too.
- Click a collection. It opens in its own tab and runs straight away, showing the first 50 documents.
- To open a deeper path such as
users/alice/orders, right-click the project or database and choose Open path…, or use Open path… at the end of the collection list.
Each tab keeps its own query, and your tabs come back the next time you open Firetool. Right-click a collection and choose Open in new tab to have the same collection open twice with different filters.
The path box
The query bar starts with Simple and JS Query (see JS Query), the project button, and the path box. The path box holds the collection the tab reads.
- Click it or start typing to see suggestions: top-level collections, or the subcollections under a document once you type
users/alice/. - After a collection name and a slash, it suggests the IDs of the documents loaded in the tab.
- If you enter a document path (an even number of parts, such as
users/alice) and run, Firetool shows its collection and opens that document in the editor.
Add filters
- Choose Filter. A new line appears with a field box, an operator, a value box and a value type.
- Type the field name, or pick it from the suggestions. Use dots for a field inside a map, such as
address.city. Choose__name__to filter on the document path. - Choose the operator (the table below lists them).
- Type the value, or pick one of the values found in the loaded documents.
- Check the value type. Auto guesses from what you type; when you pick a field, Firetool sets the type the field has in your data. The other types are String, Number, Boolean, Timestamp, Reference, Null and JSON.
- For a Timestamp, the value box becomes a date box and a time box, in your computer's time zone (shown beside them). The time is optional: a date on its own means midnight. Hover over them to see the exact UTC time Firetool sends.
- Remove a filter with its ✕.
| Operator | Matches documents where the field |
|---|---|
== / != | equals / doesn't equal the value |
< <= > >= | is less than, at most, greater than, at least the value |
array-contains | is an array that contains the value |
array-contains-any | is an array that contains any value in the list |
in / not-in | equals one of / none of the values in the list |
is null / is not null | is null / is anything but null (no value box) |
starts with | is text that begins with the value, such as names starting with Rav. Firestore has no such operator, so Firetool sends a range (from the value up to the value followed by the highest character), and the results are sorted by that field. |
For in, not-in and array-contains-any, type the list as a, b, c or as a JSON array such as ["a", "b"]. In a JSON array with the Auto type, values in quotes stay text, so IDs like "007" aren't turned into numbers.
The type matters: a number stored as text only matches with the String type. If nothing matches, Firetool reminds you to check the field names and value types.
Match all or any
With two or more filters, a box appears before them: Match all filters (AND, every filter must match) or Match any filter (OR, at least one must match).
Groups of filters (AND / OR)
Once there's a filter, + Group adds a group of filters that combine on their own, with its own Match all or Match any. For example, the filter status == Open with a group set to Match any holding country == IN and country == US finds open orders from either country. With Match any at the top and a group set to Match all, it finds documents that meet the first filter, or every filter of the group.
Use + Filter inside a group to add to it, and ✕ on the group to remove it; removing its last filter removes the group too. Saved queries, history, team sharing, scheduled exports, Totals, charts, exports and Query as code keep the groups.
Firestore works the filters out into combinations of "all of these" and takes at most 30 of them; each value of an in or array-contains-any list counts as one. A query over that stops with a message saying how many it makes, before anything is read.
Sort and limit
- Choose Sort and type or pick a field. Without a sort, documents come in document ID order.
- Click the arrow to switch between ascending (↑) and descending (↓). Add more sorts for ties.
- Set Rows in the bar at the bottom: how many documents a Run reads, and Load more adds. It starts at 50; Other… takes any number up to 10,000.
You can also sort or filter from a column: click the ⋮ in its header and choose Sort ascending, Sort descending, Filter by this field… or Only docs that have it. Right-click a cell for Filter … == this and Filter … != this, which add the filter and run.
Collection groups
Tick Group in the query bar to query every collection with that name, at any depth: orders then means users/alice/orders, users/bob/orders and so on. Or right-click a collection in the sidebar and choose Open as collection group. In a group tab the first column shows each document's full path. To add or import documents, open one of the collections by its full path, because a group has no single place to write to.
Run and read the results
- Choose Run, or press Enter in any box of the query bar (Ctrl+Enter works too).
- Switch between Table, Tree, JSON and Chart above the results. The tree and JSON views are for reading; edit in the table or the document editor. ChartMap viewSplit view groups the loaded rows into a chart.
- The status bar shows how many documents were loaded, with a + when there are more. Load more reads the next batch of the same size.
The table shows every loaded row: scroll to any of them, even with tens of thousands loaded. To keep the window quick, it draws only the rows near what you see, and sorting, ticking and Load more stay quick. The Tree and JSON views draw 500 rows at a time, with Show 500 more rows below them; those rows are already loaded, so this reads nothing from Firestore.
When a query finds nothing, Firetool offers what to do next: Clear filters and sorts when a filter matches nothing, New document and Import… for an empty collection, Try again when the query failed. To find a value in collections you haven't loaded, see Search Firestore data.
- Filter rows searches the rows already loaded, without a new query.
- Clicking a column header sorts the loaded rows (▲ ▼). An ↑ or ↓ in a header shows the field the query itself is sorted by.
- Columns hides or shows columns.
Changes in the query bar count only after you run them. Until then, Load more, Live, exports and other jobs keep using the query of the last run.
Chart the results
- Run the query, then choose Chart above the results. Firetool picks a field to start with: a date field, or one with a handful of values such as a status.
- In Group by, type or pick any field. Dates are grouped per hour, day, week, month or year (Auto picks one), in your time zone; numbers in ranges; text and true/false by value, the 20 biggest and Other. A list counts once for each of its items.
- In Show, choose Number of documents, or Sum of, Average of, Lowest or Highest and a number field.
- Optionally, Split by a second field: each of its values gets a colour, up to 8.
- Choose Bar, Line or Pie. Hover over the chart to see the values; the same numbers are in a table under it.
A chart uses the loaded rows (and Filter rows), and says how many. When more documents match, Load all matching reads them all, asking first when that's more than 10,000. Copy table copies the numbers to paste into a spreadsheet; Save chart… saves an SVG image and needs Pro, like exports. The chart's settings stay with the tab.
See locations on a map
When documents have a location, choose Map above the results. A location is a GeoPoint field, or a map field with latitude and longitude numbers in it, such as { lat, lng } or { latitude, longitude }. If there are several, pick one in Location.
- Drag to move around; use the mouse wheel, + and − to zoom, and Fit to see every point again.
- Hover over a point to see the document's ID and its coordinates; click it to open the document.
- The map shows the loaded documents and says how many have no location. Load more adds the next ones.
The map is drawn by Firetool itself, from world outlines that come with the app, so it works offline and nothing about your data is sent to a map service.
Compare side by side (split view)
Choose View → Split view (Ctrl+\, ⌘+\ on a Mac), or right-click a collection in the sidebar or a tab and choose Open in split view. A second view opens beside the main one, with its own tabs, query, results and document editor, so you can compare two collections, two projects, or production and staging. Drag the edge between them to resize. In the split view, a tab's Open in the main view sends it back; ✕ closes it, and its tabs come back the next time you open it. Both views follow the same project rules and write to the same audit log.
See the data as it was earlier
- Choose Now (the clock button) in the query bar.
- Pick a quick time, such as 15 minutes ago, or a date and time, then Show.
- The tab now shows the data as it was then, with a banner saying so. The table, Load more, Totals, charts and exports all use that time. Choose Back to now to return.
Firestore keeps every version for the last hour. With point-in-time recovery turned on for the database (in the Google Cloud console; Firestore charges for the storage), it keeps 7 days. The dialog says which applies to the database you're in.
While a tab shows an earlier time, editing is off. Open a document to see it as it was, then choose Restore this version to set it back: every field, and it's created again if it was deleted since. Firetool keeps a copy of the current version in the audit log, so you can undo it. To restore many documents, use Actions ▾ → Copy to… from the same tab into the same collection, with Replace it.
Count, sum and average without loading
- Set up the filters you want, then choose Σ (Totals) in the query bar.
- Choose Count, or a Sum of or Average of one of the number fields listed. Another field… lets you type any field.
- The answer appears at the bottom of the window, with Copy.
Totals cover every document the query matches, not only the loaded rows and not limited by #. Firestore works them out without sending the documents: about one read per 1,000 documents matched. For sum and average, documents without a number in that field are skipped.
See how many documents you've read
The status bar shows how many Firestore documents Firetool has read since it opened, roughly what Firestore bills as reads. It's a total for the session, across every tab, collection and project, so it can be more than the documents in a collection: running a query again reads its first rows again. Click it to see the count for each project, or choose Start again to reset it. Emulators aren't counted.
Before a job reads a whole query (an export, a copy, a backup or a bulk field change), Firetool counts the matching documents first and asks before reading more than 10,000.
Live refresh
- Choose Live: off above the results.
- Pick Every 15 seconds, Every 30 seconds, Every minute or Every 5 minutes. Choose Off to stop.
Live runs the query again on its timer; it doesn't listen to Firestore, so a change shows at the next refresh. New rows flash green and changed rows flash amber, and an open document shows its latest version. Each refresh re-reads up to the first 500 rows and is billed as reads; it pauses while Firetool is minimised.
New in 4.5.5: on an emulator project, where reads cost nothing, the choices are Every second, Every 2 seconds, Every 5 seconds, Every 15 seconds and Every minute. Real projects keep at least 15 seconds.
Save a query
- Choose Save (the star) in the query bar and give the query a name.
- Open the saved queries with the star icon at the bottom of the sidebar. Click one to open it in a tab and run it.
- To change a saved query, open it, adjust it and choose Saved (the filled star): keep the name to update it, or type a new one to save a copy. Rename or delete it with the icons on its row.
Saved queries keep the path, filters, sorts, limit and the Group setting, and are stored on this computer only. A saved JS script opens without running; press Run when you're ready.
Query history
Choose ⟲ in the query bar to see the queries you ran with filters or sorts: this collection's first, then the others, newest first. Choose one to put it back in the tab, or, for another collection, to open it in a new tab. Firetool keeps the last 100 on this computer; Clear history empties the list.
The query as code
Choose </> in the query bar to see the query of the last Run as code for your app: Node.js (the Admin SDK), Web (the modular SDK), Python and Flutter. Values keep their types, such as numbers, timestamps and references, and Starts with becomes the two range filters it is. Choose Copy and paste it into your code.
Run the same query in another project
The project button in the query bar (with ▾) shows where the tab's query runs. Choose it to see the other databases of this project and the projects of every connected account. Pick one and the same path, filters and sorts run there. This is handy for comparing staging and production.
Explain a query
To see how Firestore runs a query, run it, then choose Actions ▾ → Explain this query (or find it in the command palette). It explains the query of the last Run.
- Show the plan names the index Firestore would use. It reads nothing.
- Run and measure runs the query once and shows the documents returned, the index entries and documents scanned, the read operations, the time it took in Firestore and the estimated cost.
Under the numbers, Firetool says in plain words what would help (4.2):
- when Firestore looks at far more entries than it returns (100 or more, over ten times as many), the composite index that would let it go straight to the matching documents, with Create this index…; or, when the query already uses that index, that the filters themselves need narrowing;
- "not equal" and "not in" filters, which look through every value except the ones left out ("equals" or "in" looks at only those);
- ranges on several fields, and which one to sort by first;
- a query that reads 1,000 documents or more each time, which a smaller page would read less of;
- otherwise, that there's nothing to improve.
Show the plan already gives the advice that follows from the query itself. After Run and measure, If it runs [1,000] times a day shows the reads and estimated cost a day and a month. Measure the same query again later (for example once a new index is built) and Firetool shows what changed since: fewer entries looked at, less time.
Indexes
Firestore creates single-field indexes by itself, but a query that filters on one field and sorts on another needs a composite index. When it's missing, the query fails and Firetool shows the error with its link. When it can work out the index, it also shows Create the index for this query….
- Choose Create the index for this query…, or Tools → Indexes…, or right-click a collection and choose Indexes… to see only that collection's indexes.
- The list shows each index's collection, fields, scope (Collection or Collection group) and state (Ready or Building).
- Under New index, check the Collection name and Queries on (this collection, or every collection with this name). Each field is Ascending, Descending, Array contains or Vector (for
findNearest: give its size, the number of dimensions; it goes last); Add field adds another. Put the fields you filter with "equals" first, then the ones you sort or filter by range, in the query's order. - Choose Create index. Firestore takes a few minutes to build it; until then the query still fails. Use Refresh to check.
Listing indexes is free. Creating and deleting them needs Pro. On a project marked production, you're asked to type the project ID first.
The indexes window's Advice looks at your recent and saved queries in that database and lists:
- indexes those queries need and don't have (Fill in below puts one into New index);
- duplicate indexes (Delete one);
- indexes whose fields start a longer index: they may not be needed, so check your app's queries before deleting;
- how many of Firestore's 200 composite indexes the database uses.
Firestore keeps no record of which index a query used, so Firetool doesn't guess which indexes are unused.
To make one project's indexes match another's, choose Compare with… in the indexes window and pick the other project or database. Firetool lists the indexes both have, the ones missing here (ticked) and the ones only here, and Create N here creates the missing ones in one go. Fields set apart from the default and TTL policies are compared too, and set here as the other has them. Indexes, field settings and TTL policies that exist only here are never removed.
Single-field settings and TTL policies
Firestore indexes every field by itself. The indexes window lists the fields set apart from that, and the fields with a TTL policy. Set a field… (or Change… on one in the list) chooses how a field is indexed: Automatic, or only the kinds you tick for this collection and for the collection group. Nothing ticked means the field isn't indexed: good for long text, or a value that changes many times a second, and queries can't filter or sort on it.
A TTL policy makes Google delete each document once the time in that timestamp field has passed, usually within a day, as ordinary deletes. Firetool can't bring those documents back, so turning one on asks you to type the project ID on every project, not only production.
Each change needs Pro and is in the audit log with the setting before it; its entry offers Put back the earlier setting…. Backups keep field settings, and a restore puts the indexing back but never turns a TTL policy on. In the terminal: firetool indexes fields <project>.
Keep numbers, lists and charts on a dashboard
The Dashboard (the grid icon at the bottom of the sidebar, or Tools → Dashboard) shows cards that read fresh data each time it refreshes:
- Number: how many documents match a query, or the sum or average of a field. Firestore adds them up without sending the documents (about one read per 1,000 documents counted). Run the query, then Actions ▾ → Add to dashboard….
- List: the first 5, 10 or 20 documents of a query in its order, such as the newest orders (sort the query first); click one to open it. Also from Actions ▾ → Add to dashboard….
- Chart: under any chart, Add to dashboard (it reads up to the documents it was added with, at most 5,000).
- Schema check: in a collection's Schema, once you've saved the expected schema, Add to dashboard checks its first documents against it.
- From + Add card: Authentication users (totals: all, disabled, new and signed in during the last 7 days; no Firestore reads), Storage usage (a bucket or folder's files and size; no Firestore reads) and Firetool activity (documents read, tasks; nothing read).
Each card says what it reads, and the toolbar adds it up: "Each refresh reads about N documents". Refresh reads every card again; choose every 1, 5, 15 or 60 min to refresh by itself while the Dashboard is the tab on screen. With cards from several projects, Project shows one project's. Use ↻ to refresh a card, ↑ to move it, ↗ to open its query as a tab and ✕ to remove it. The cards are kept on this computer.
How Firetool builds the query
- When you filter with a range or inequality (
<,<=,>,>=,!=,not-inoris not null), Firetool also sorts by that field, as Firestore requires, after any sorts you chose. - Sorting by a field leaves out documents that don't have it. The column menu says so ("skips docs without it"), and Totals keep the sort, so they count the same documents the table would show.
- Firetool doesn't work out an index for queries that use Match any (at the top or in a group): Firestore needs one per branch, so follow the link in the error instead.
Questions
Does Σ Totals read every document?
No. Firestore counts, adds up or averages on its side and bills about one read per 1,000 documents matched, so you can total a large collection without loading it.
Why does my filter match nothing?
Usually the value type: a number saved as text needs the String type, and a date needs Timestamp. Pick the field from the suggestions so Firetool sets the type from your data, and check the field name's spelling and dots.
Is there a limit to how many documents I can load?
Rows, in the bar at the bottom, goes up to 10,000 per run, and Load more reads the next batch. To get everything a query matches into a file, use Export, which ignores the limit.
Related
- Firestore query tool: what the query bar and JS Query can do, in one page.
- Run JavaScript queries: OR filters, cursors, transactions and vector search in code.
- Edit documents: change what your query found.
- Export to CSV, Excel or JSON: save every document a query matches.