Overview
This node integrates with Google Cloud Firestore to manage documents within Firestore databases. Specifically, the Update operation allows users to modify existing documents at a specified path in Firestore by providing new JSON data.
Common scenarios where this node is beneficial include:
- Updating user profiles or settings stored in Firestore.
- Modifying configuration documents dynamically based on workflow inputs.
- Syncing external data changes into Firestore documents.
For example, you might use this node to update a Firestore document representing an order status after processing payment, or to change metadata of a content item in a CMS backed by Firestore.
Properties
| Name | Meaning |
|---|---|
| Path | The Firestore path to the collection or document to update. This should be a valid Firestore document path (e.g., collectionName/documentId). Supports placeholders like {id} for dynamic segments. |
| Data (JSON) | The JSON object containing the fields and values to update in the document. Supports special Firestore types using specific JSON structures: - Reference: {"__type":"reference","path":"..."} - Timestamp: {"__type":"timestamp","value":"ISO_DATE"} - GeoPoint: {"__type":"geopoint","latitude":NUM,"longitude":NUM} |
Output
The output JSON structure for the Update operation includes:
success: Boolean indicating if the update was successful (true).operation: The string"update"indicating the performed operation.path: The Firestore document path that was updated.
Example output JSON:
{
"success": true,
"operation": "update",
"path": "collectionName/documentId"
}
No binary data output is produced by this node.
Dependencies
- Requires a valid Google Cloud Firestore service account credential configured in n8n as an API key credential.
- The node uses the Firebase Admin SDK internally to connect and authenticate with Firestore.
- The Firestore database must be accessible with the provided credentials and have appropriate permissions for updating documents.
Troubleshooting
- Invalid JSON format in Data field: If the JSON data provided is malformed or cannot be parsed, the node will throw an error. Ensure the JSON is valid and correctly formatted.
- Data field is not a valid object or JSON string: The data input must be either a JSON string or an object. Passing other types will cause errors.
- Invalid collection path for auto-ID: When using paths ending with
/{id}, ensure the preceding path is a valid collection path; otherwise, the node cannot generate a new document ID. - Document not found: Although more relevant for read operations, attempting to update a non-existent document may result in Firestore errors depending on Firestore rules.
- Firestore Error: General errors from Firestore (e.g., permission denied, network issues) are wrapped and reported with their messages. Verify credentials and Firestore access rights.