Query Builder
Build, run, save, and generate code for Firestore queries with a visual query builder.
Overview
The Query Builder provides a visual interface for constructing Firestore filter queries without writing code. Build filter clauses, combine them with AND or OR logic, set ordering and limits, and run queries against your collection.
Opening the Query Builder
Toggle the query builder panel from the toolbar above the document table. The panel appears below the toolbar with space for filter clauses, ordering, and limits.
Building Queries
Adding Filter Clauses
- Click Add Filter to create a new clause.
- Enter the field name (supports nested paths like
address.city). - Select an operator:
==,!=,<,<=,>,>=,in,not-in,array-contains,array-contains-any. - Enter the value to compare against.
AND / OR Composition
When you have two or more filter clauses, choose the composition mode:
- AND — documents must match all clauses
- OR — documents must match at least one clause
Firestore’s query limitations apply: OR queries require specific conditions, and Stackpane validates your query before execution.
Ordering
Set a field name and direction (ascending or descending) to order results. Firestore requires that the first field in an inequality filter matches the order-by field.
Result Limits
Set a maximum number of documents to return. This is useful for sampling data or limiting result sets for performance.
Running Queries
Click Run Query to execute. Stackpane validates the query before sending it to Firestore and displays inline errors if any clauses are invalid. Results replace the current document table contents with the filtered results.
Saving Queries
Save frequently used queries for later reuse:
- Build your query with the desired clauses.
- Click Save and enter a descriptive name (e.g., “Active users this year”).
- Access saved queries from the Saved Queries menu in the toolbar.
Saved queries are stored per-connection, so different projects maintain separate query libraries.
Query History
Stackpane automatically records recently executed queries. Access your history from the Recent Queries menu to quickly re-run previous queries.
Aggregate Queries
Run COUNT, SUM, and AVG operations against a collection:
- Open the aggregate panel from the toolbar.
- Select the aggregation type: COUNT, SUM, or AVG.
- For SUM and AVG, enter the field name to aggregate.
- Click Run to see the result.
Aggregate queries respect any active filter clauses, so you can count or sum only matching documents.
Code Snippet Generation
Generate code from your current query for use in your application:
- Build a query in the visual builder.
- Click Generate Code.
- Copy the generated code snippet for your application.
This is useful for prototyping queries in Stackpane and then transferring them to your codebase.