Reference · Tools
Google Cloud Firestore
Create, read, update, delete, and query documents and collections in Google Cloud Firestore.
The Google Cloud Firestore node lets you create, read, update, delete, and query documents and collections in Firestore directly from a BusyBot workflow. You can use it to build things like a user-onboarding flow that writes a new Firestore document on signup, or a nightly job that queries and archives stale records. Documents are returned as plain JSON with decoded fields and metadata.
- Node type
- Action
- Parameters
- 24
- Outputs
- —
Google Cloud Firestore
Create, read, update, delete, and query documents and collections in Google Cloud Firestore.
Overview
Integrates with the Firestore REST API v1 to manage documents and collections. It supports creating a document (with an optional document ID), batch get, listing a collection with pagination, delete, batch upsert with field masks, structured queries, and listing root collection IDs. Data is encoded and decoded using Firestore’s typed value format, so the values you send and read back are ordinary JSON. Authentication is available via OAuth2 or a service account. Simplify mode returns each document with underscore-prefixed metadata merged alongside its decoded fields.
Category: Data & Storage
Tool Name: google_cloud_firestore
Version: 1
Appearance: Icon: lucide-Database | Color: #FFA000
Node Type
Action — processes input items and produces output
Input / Output
| Direction | Port(s) |
|---|---|
| Input | main |
| Output | main, error |
Credentials
This tool requires Google Firebase Cloud Firestore OAuth2, Google API (Service Account) credentials. See the Credentials Guide for setup instructions.
Configure the one that matches the Authentication parameter — OAuth2 or service account, not both.
Resources
| Resource | Value |
|---|---|
| Document | document |
| Collection | collection |
Operations
| Operation | Value | Description |
|---|---|---|
| Create | create | Create a new document in a collection. |
| Delete | delete | Delete a document. |
| Get | get | Get one or more documents by ID (batch). |
| Get Many | getAll | Get all documents in a collection or list all root collection IDs. |
| Query | query | Run a structured query against a collection. |
| Upsert | upsert | Create or update documents (batch write). |
Every operation applies to the Document resource. The Collection resource offers getAll only.
Parameters
Document: Create
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Collection | string | Yes | — | The collection ID or path (e.g. “users” or “users/userId/orders”). Supports expressions. |
| Document ID | string | No | — | Optional document ID. If omitted, Firestore auto-generates one. |
| Columns | string | No | — | Comma-separated list of item fields to write as document fields. Leave empty to write all fields from the item JSON. |
| Simplify | boolean | No | true | Return simplified output with underscore-prefixed metadata merged with document fields. |
Document: Delete
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Collection | string | Yes | — | The collection ID or path (e.g. “users” or “users/userId/orders”). Supports expressions. |
| Document ID | string | Yes | — | The document ID (last path segment). For nested collections use the full relative path (e.g. “docId/subcollection/subDocId”). |
Document: Get
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Collection | string | Yes | — | The collection ID or path (e.g. “users” or “users/userId/orders”). Supports expressions. |
| Document ID | string | Yes | — | The document ID (last path segment). For nested collections use the full relative path (e.g. “docId/subcollection/subDocId”). |
| Simplify | boolean | No | true | Return simplified output with underscore-prefixed metadata merged with document fields. |
Document: Get Many
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Collection | string | Yes | — | The collection ID or path (e.g. “users” or “users/userId/orders”). Supports expressions. |
| Return All | boolean | No | false | Whether to return all results or only up to a given limit. |
| Limit | number | No | 100 | Max number of documents to return. (shown when Return All is false) |
| Simplify | boolean | No | true | Return simplified output with underscore-prefixed metadata merged with document fields. |
Document: Query
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Collection | string | Yes | — | The collection ID or path (e.g. “users” or “users/userId/orders”). Supports expressions. |
| Query | string | Yes | — | A JSON string containing a Firestore structuredQuery object. Example: {“from”:[{“collectionId”:“users”}],“where”:{“fieldFilter”:{“field”:{“fieldPath”:“age”},“op”:“GREATER_THAN”,“value”:{“integerValue”:“18”}}}} |
| Simplify | boolean | No | true | Return simplified output with underscore-prefixed metadata merged with document fields. |
Document: Upsert
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Collection | string | Yes | — | The collection ID or path (e.g. “users” or “users/userId/orders”). Supports expressions. |
| Update Key | string | Yes | — | The field in the item data to use as the Firestore document ID. |
| Columns | string | No | — | Comma-separated list of item fields to write. Leave empty to write all fields. |
Collection: Get Many
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Return All | boolean | No | false | Whether to return all collection IDs or only up to a given limit. |
| Limit | number | No | 100 | Max number of collection IDs to return. (shown when Return All is false) |
All Operations
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Authentication | options | No | oAuth2 | Authentication method to use. |
Options: oAuth2, serviceAccount | ||||
| Google Account | credential | No | — | Connect or select your Google account. (shown when Authentication is oAuth2) |
| Service Account Email | string | Yes | — | The email address of the Google service account. (shown when Authentication is serviceAccount) |
| Private Key | string | Yes | — | The private key from the service account JSON key file. (shown when Authentication is serviceAccount) |
| Project ID | string | Yes | — | The Google Cloud project ID (e.g. “my-project-123”). |
| Database | string | No | (default) | The Firestore database name. Use “(default)” for the default database. |
| Max Concurrency | number | No | 5 | Maximum number of items to process concurrently. |
Output Data
The output item’s JSON is the Firestore result — the incoming item’s JSON does not pass through — while binary data on the input item is forwarded.
With Simplify on (the default), a document arrives with its decoded fields at the top level and its metadata under underscore-prefixed keys:
{
"_name": "projects/my-project-123/databases/(default)/documents/users/user123",
"_id": "user123",
"_createTime": "2024-01-15T09:30:00.123456Z",
"_updateTime": "2024-01-15T09:30:00.123456Z",
"name": "Ada Lovelace",
"email": "ada@example.com",
"age": 36
}
Turn Simplify off to receive the raw Firestore document instead, with name, createTime, updateTime and a fields object still in Firestore’s typed value format.
| Operation | Output |
|---|---|
document / create | One item — the created document. |
document / delete | One item carrying success: true. |
document / get | One item per requested document. A document that does not exist produces an error item rather than an empty one. |
document / getAll | One item per document in the collection, paginated up to Limit (or all of them with Return All on). |
document / query | One item per matching document. |
document / upsert | One item per written document, carrying the write result (updateTime). |
collection / getAll | One item per collection, each carrying a single collectionId property. |
Address the result downstream with expressions such as {{ $json._id }} or {{ $json.email }}.
Usage Examples
- Use Google Cloud Firestore in a workflow to create, read, update, delete, and query documents and collections in Google Cloud Firestore
Example Configuration
Create a document with an explicit ID, writing only three fields from the item:
{
"type": "google_cloud_firestore",
"parameters": {
"authentication": "oAuth2",
"resource": "document",
"operation": "create",
"projectId": "my-project-123",
"database": "(default)",
"collection": "users",
"documentId": "user123",
"columns": "name,email,age",
"simplify": true
}
}
Read a single document back:
{
"type": "google_cloud_firestore",
"parameters": {
"authentication": "oAuth2",
"resource": "document",
"operation": "get",
"projectId": "my-project-123",
"database": "(default)",
"collection": "users",
"documentId": "{{ $json.userId }}",
"simplify": true
}
}
List the first hundred documents in a collection:
{
"type": "google_cloud_firestore",
"parameters": {
"authentication": "oAuth2",
"resource": "document",
"operation": "getAll",
"projectId": "my-project-123",
"database": "(default)",
"collection": "users",
"returnAll": false,
"limit": 100,
"simplify": true
}
}
Run a structured query:
{
"type": "google_cloud_firestore",
"parameters": {
"authentication": "oAuth2",
"resource": "document",
"operation": "query",
"projectId": "my-project-123",
"database": "(default)",
"collection": "users",
"query": "{\"from\":[{\"collectionId\":\"users\"}],\"where\":{\"fieldFilter\":{\"field\":{\"fieldPath\":\"age\"},\"op\":\"GREATER_THAN\",\"value\":{\"integerValue\":\"18\"}}}}",
"simplify": true
}
}
Create or update many documents in one batch, keyed on a field of the incoming items:
{
"type": "google_cloud_firestore",
"parameters": {
"authentication": "oAuth2",
"resource": "document",
"operation": "upsert",
"projectId": "my-project-123",
"database": "(default)",
"collection": "users",
"updateKey": "userId",
"columns": "name,email,age"
}
}
Delete a document:
{
"type": "google_cloud_firestore",
"parameters": {
"authentication": "oAuth2",
"resource": "document",
"operation": "delete",
"projectId": "my-project-123",
"database": "(default)",
"collection": "users",
"documentId": "user123"
}
}
Read a document out of a nested subcollection:
{
"type": "google_cloud_firestore",
"parameters": {
"resource": "document",
"operation": "get",
"projectId": "ecommerce-project",
"collection": "users/user123/orders",
"documentId": "order456",
"simplify": true
}
}
List every root collection in the database:
{
"type": "google_cloud_firestore",
"parameters": {
"authentication": "oAuth2",
"resource": "collection",
"operation": "getAll",
"projectId": "my-project-123",
"database": "(default)",
"returnAll": false,
"limit": 50
}
}
Error Handling
| Mode | Behavior |
|---|---|
| stop | Halts workflow on first error |
| continue | Skips failed items, passes successful ones through |
| errorPort | Routes failed items to Error output port |
Tips
Create, read, update, delete, and query documents and collections in Google Cloud Firestore. Use when you need NoSQL document storage operations or structured queries against Firestore. Returns documents with decoded fields and metadata.
Databaseis almost always(default). Only change it if you created a named Firestore database in the project.- Nested collections use a path.
users/user123/ordersaddresses a subcollection; the Document ID for a get or delete may itself be a relative path such asdocId/subcollection/subDocId. Columnsfilters what gets written. Leave it empty to write the whole item; name fields to keep unrelated workflow metadata out of the document.- Upsert needs a key that exists on every item. Update Key names the item field whose value becomes the document ID; an item where that field is missing or empty fails rather than creating an unnamed document.
GetandUpsertbatch across items. All the items reaching the node in one run are grouped into a single Firestore call per project and database, so a large batch is far cheaper than one call per item.- Query takes a raw structuredQuery. Supply the JSON object Firestore’s
runQueryexpects, including itsfromclause; values insidewhereuse Firestore’s typed form such as{"integerValue":"18"}. Get ManyandQueryfan out — each document becomes its own item, so downstream nodes process documents individually.
Frequently asked questions
Which credentials do I need — OAuth2 or a service account?
Both work. OAuth2 (Google Firebase Cloud Firestore OAuth2) is the easier choice if you're already signed into Google and working interactively. A service account (Google API - Service Account) is better suited to automated, unattended workflows because it doesn't require a user session. Pick one and configure it in the node's credentials field before running.
What should I put in the Database field?
Almost always `(default)`. Firestore creates a database named `(default)` unless you explicitly created a named database in your GCP project. Only change this value if you know you have a named database and need to target it specifically.
How do I read or delete a document inside a subcollection?
Use a path in the Document ID field, not just the final document ID. For example, to target a document inside a subcollection, set Collection to `users` and Document ID to `user123/orders/order456`. The node resolves the full path from those two values combined.
My Upsert operation is failing for some items but not others — what's wrong?
Upsert requires every item to have the field named in Update Key, and that field must be non-empty. If any item is missing that field or its value is blank, that item fails rather than creating a document with an auto-generated ID. Check that the field exists on all items reaching the node, and that no item has a null or empty value for it.
How do I write a structured query, and what format do filter values need to be in?
Set the operation to Query and supply a raw JSON object matching what Firestore's `runQuery` endpoint expects, including a `from` clause naming your collection. Values inside `where` must use Firestore's typed format — for example, an integer 18 must be written as `{"integerValue": "18"}` rather than just `18`. Each matching document is returned as its own output item, so downstream nodes process them one at a time.
Build with the Google Cloud Firestore node
Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Google Firebase Cloud Firestore OAuth2 credentials first.
Open BusyBotLast updated . Spotted something wrong? Tell us.