Home CLI guides Firestore CLI

Firestore CLI

Last updated on May 07, 2026

Purpose

The Firestore CLI covers simple query and single-document create/update/delete automation through shared FirestructCore services.

Query Documents

firestore query --collection users --limit 50
firestore query --collection users --where "role == admin" --order-by "createdAt desc"
firestore query --project demo-firestruct --collection users --limit 0

Options:

  • --collection is required and accepts a collection path.
  • --limit defaults to 50; 0 means no explicit limit where supported by the service.
  • --where accepts Firestruct simple-query syntax.
  • --order-by accepts comma-compatible parsed order clauses from the query service.
  • --project optionally overrides selected project.

Output contains:

  • selected project JSON
  • documents
  • logs

Create Document

firestore create --collection users --document-id alice --data '{"name":"Alice"}'
firestore create --collection users --document-id alice --data '{"name":"Alice"}' --allow-overwrite

Required options:

  • --collection
  • --document-id
  • --data

--allow-overwrite permits replacing an existing target when the core service supports it.

Update Document

firestore update --document users/alice --data '{"name":"Alice"}'

Required options:

  • --document
  • --data

Delete Document

firestore delete --document users/alice --confirm

Required options:

  • --document
  • --confirm

Deletes fail without --confirm.

Run Through Selected Module

module select firestore
run query --collection users --limit 50

run dispatches Firestore actions only when the selected CLI module is firestore.

Not Yet Covered by CLI

The GUI Firestore module has broader coverage than the current CLI. These flows are not first-class CLI commands yet:

  • JS Query execution
  • bulk field operations
  • import/export/transfer/backup
  • recursive copy/move/rename
  • schema analyzer
  • vector nearest-neighbor query mode
  • saved query/script management

Source Anchors

  • Sources/FirestructCLIKit/FirestoreCommand.swift
  • Sources/FirestructCore/FirestoreSimpleQueryService.swift
  • Sources/FirestructCore/FirestoreDocumentWriteService.swift