Purpose
The Firestore module is the primary data exploration and mutation workspace. It covers simple queries, JavaScript queries, table/tree/json/log output, document and collection CRUD, schema analysis, import/export, transfer, backups, and context actions.
Query Modes
Simple Query
The simple query builder supports:
- collection, subcollection, and document paths
- collection group queries
- multiple
whereclauses - multiple
orderByclauses - nested-field autocomplete
- document reference values in filters
- explicit limit, including zero for all documents
- query validation before execution
- saved queries
- vector nearest-neighbor query mode when the vector search flag is enabled
Supported operators:
< <= == > >= != array-contains array-contains-any in not-in starts-with
starts-with is a prefix-search abstraction. Firestore index errors surface with creation links and Index Advisor context where available.
JS Query
JS Query runs local JavaScript with an async run() entrypoint and Firebase Admin context. It supports Firestore reads, writes, deletes, batches, count aggregation, structured returns, logs, and utility packages exposed by the bundled runtime.
Output Modes
TABLE: editable grid, column controls, inline values, selections, context actionsTREE: hierarchical document/collection navigation, including remembered subcollectionsJSON: read-only structured result viewLOGS: transport, app, warning, error, and script logs
Table and Column Controls
Users can:
- show, hide, search, and reorder columns
- drag columns in the columns panel
- toggle system columns such as
Doc ID,createTime,updateTime, andreadTime - split nested map fields into columns and unsplit them
- persist column configuration in saved tab/query state
- quick-filter visible rows
- copy/paste cells
- use keyboard navigation
- multi-select rows with shift-click
- copy field values and field names from context menus
Data Editing
Document workflows:
- create document
- edit fields inline
- edit whole document as JSON
- duplicate document
- copy document
- move document
- rename document ID
- delete document
- reveal/open current collection or document in Firebase Console
Collection workflows:
- create collection
- rename collection through recursive copy and cleanup
- duplicate/copy/move collections across projects
- delete collections
- include nested subcollections in recursive copy/move/rename flows
Bulk field workflows:
- add a field with a constant value to a collection/query/selection
- rename a field across documents
- delete a field across documents
Move, rename, duplicate, and copy dialogs show source project/path, target project/path, overwrite warning, operation semantics, and same-project path validation.
Import, Export, Transfer, Backup
Export supports:
- JSON
- newline-delimited JSON
- CSV
- archive backups
- query-result exports
- path-scoped exports
- document ID and resource path inclusion
- subcollection inclusion
- pre-export preview
- optional reveal in file manager
Import supports:
- JSON array/object roots
- Firefoo special type syntax such as
__time__,__lat__,__lon__,__ref__, bytes, and double markers - CSV type mapping
- column normalization
- root-level import from absolute document path column
- Latin1 files
- JSON, CSV, and archive file selection
- target project and target path validation
Transfer supports:
- project-to-project and project-to-emulator transfers
- selected collections
- include/exclude subcollections
- optional target clean first
- document reference transformation
- saved transfer definitions
- context-driven direct copy/move across projects
Large imports, exports, backups, recursive mutations, and transfers run through Tasks.
Schema and Inspection Tools
The schema analyzer can inspect collection structure and generate:
- tree schema
- TypeScript
- Dart
- Kotlin
- Java
- Swift
- Objective-C
- JSON Schema
Tree tools include expand all, collapse all, and CSV export. Result views include generated header metadata.
Visualization support includes GeoPoint maps, latitude/longitude field maps, and image URL previews.
Safety
- Read-only projects block Firestore writes and destructive actions.
- Pro access gates writes, deletes, imports, exports, transfers, saved queries/scripts, and script execution.
- Production mutations require confirmation.
- Overwrite and delete behavior is never hidden.
Source Anchors
Sources/FirestructApp/Features/Firestore/UI/FirestoreModuleView.swiftSources/FirestructApp/Features/Firestore/UI/FirestoreModuleView+QueryControls.swiftSources/FirestructApp/Features/Firestore/UI/FirestoreModuleView+Controls.swiftSources/FirestructApp/Features/Firestore/UI/FirestoreModuleView+ImportExportControls.swiftSources/FirestructApp/Features/Firestore/UI/FirestoreModuleView+Outputs.swiftSources/FirestructApp/Features/Firestore/Services/Sources/FirestructCore/FirestoreSimpleQueryService.swiftSources/FirestructCore/FirestoreDocumentWriteService.swiftSources/FirestructCore/FirestoreSchemaAnalyzerService.swiftSources/FirestructCore/JavaScriptQueryService.swift