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

  1. Click Add Filter to create a new clause.
  2. Enter the field name (supports nested paths like address.city).
  3. Select an operator: ==, !=, <, <=, >, >=, in, not-in, array-contains, array-contains-any.
  4. 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:

  1. Build your query with the desired clauses.
  2. Click Save and enter a descriptive name (e.g., “Active users this year”).
  3. 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:

  1. Open the aggregate panel from the toolbar.
  2. Select the aggregation type: COUNT, SUM, or AVG.
  3. For SUM and AVG, enter the field name to aggregate.
  4. 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:

  1. Build a query in the visual builder.
  2. Click Generate Code.
  3. Copy the generated code snippet for your application.

This is useful for prototyping queries in Stackpane and then transferring them to your codebase.