Firestore Query Advanced
Perform advanced, dynamic queries against Firestore collections and subcollections
Overview
This node performs advanced, dynamic queries against Firestore collections and subcollections. It allows users to specify a collection path, apply multiple filters, order results, limit the number of documents returned, and paginate through results. It is useful for retrieving specific subsets of Firestore data based on complex query criteria, such as filtering documents by status, ordering by a timestamp, or paginating large datasets.
Use Case Examples
- Query a Firestore collection 'users' to retrieve all users with status 'active', ordered by their signup date in descending order, limiting results to 50 documents.
- Query a subcollection 'groups/{groupId}/matches' to get scheduled matches, starting after a specific match ID for pagination.
- Retrieve documents from a collection with simplified output containing only document IDs and data, omitting Firestore metadata.
Properties
| Name | Meaning |
|---|---|
| Collection Path | Path to the Firestore collection or subcollection to query, e.g., 'users' or 'groups/{groupId}/matches'. |
| Filters (JSON Array) | A JSON array of filter objects to apply to the query, e.g., [{"field":"status","op":"==","value":"scheduled"}]. |
| Order By | Field name to order the query results by. |
| Order Direction | Direction to order the results, either ascending or descending. |
| Limit | Maximum number of documents to return from the query. |
| Start After Value (for pagination) | Optional value to start the query after, used for pagination. Should correspond to the 'orderBy' field value if specified. |
| Simplify Output | If true, returns only the document ID and data, omitting Firestore metadata; otherwise, returns full query metadata. |
Output
JSON
results- Array of documents returned by the query, each containing document ID and data fields. If 'Simplify Output' is false, additional metadata such as query size and empty status is included.
Dependencies
- Requires Firestore service account credentials including project ID, client email, and private key for authentication.
Troubleshooting
- Ensure Firestore credentials are correctly configured; missing credentials will cause an error.
- Filters JSON must be a valid JSON array; invalid JSON will cause a parsing error.
- If using 'Start After Value', ensure it matches the type and value of the 'Order By' field to avoid query errors.
Links
- Firestore Query Documentation - Official Firestore documentation on querying data, useful for understanding query parameters and filters.