Explore Firestore databases using the firestore-cli. List collections, read documents, run queries, deep export documents with subcollections, and export results to JSON. Use when the user wants to read, query, explore, or export Firestore data.
Read-only explorer for Firestore databases via the globally installed firestore command.
The firestore CLI must be installed globally (npm install -g @csimpkins22/firestore-cli) and at least one profile must be configured.
When running firestore commands programmatically, always use the --json global flag so output is machine-readable JSON. Place --json before the subcommand:
firestore --json collections list
firestore --json doc get users/ada
firestore --json query users --limit 10
firestore --json profiles list
firestore --json profiles show <name>
firestore profiles add <name> --project <id> --credentials <path>
firestore profiles add <name> --project <id> --emulator-host <host:port>
firestore profiles add <name> --project <id> --credentials <path> --database <id>
firestore profiles use <name>
firestore profiles remove <name>
firestore --json collections list # root collections
firestore --json collections list <documentPath> # subcollections
firestore --json doc get <documentPath>
firestore --json doc get <documentPath> --deep # recursive subcollections
firestore doc get <documentPath> --out ./output.json # write to file
firestore doc get <documentPath> --deep --out ./output.json # deep export to file
firestore doc get <documentPath> --out - # write to stdout
firestore --json query <collectionPath> \
--where <field>,<op>,<value> \
--order-by <field>:<asc|desc> \
--select <field1>,<field2> \
--limit <n> \
--offset <n>
All query flags are optional. Multiple --where and --order-by flags can be combined.
Supported --where operators: <, <=, ==, !=, >=, >, array-contains, in, not-in, array-contains-any.
For in, not-in, and array-contains-any, the value must be a JSON array:
--where 'status,in,["active","pending"]'
firestore export <collectionPath> --out <file|-> \
--where <field>,<op>,<value> \
--order-by <field>:<asc|desc> \
--select <field1>,<field2> \
--limit <n> \
--offset <n>
--out is required. Use --out - for stdout.
| Flag | Description |
|---|---|
--json | Machine-readable JSON output (place before subcommand) |
--profile <name> | Override the default profile for this command |
--verbose | Include full stack traces on errors |
firestore --json profiles listfirestore --json collections listfirestore --json query <collection> --limit 5firestore --json doc get <path>firestore --json collections list <documentPath>[{ "id": "users", "path": "users" }]
{ "createTime": "...", "data": {...}, "id": "...", "path": "...", "updateTime": "..." }
{ "createTime": "...", "data": {...}, "id": "...", "path": "...", "updateTime": "...", "subcollections": { "orders": [{...}] } }
{ "collectionPath": "...", "count": 2, "documents": [{...}] }
Document "path" was not found.--where syntax throws a validation error with the expected format--verbose to get full stack traces for debugging