Firestore

Read and write documents to Firebase Firestore

Overview

This node interacts with Firebase Firestore to perform various document operations such as retrieving, deleting, setting, updating, adding documents, and querying collections. It is useful for workflows that require integration with Firestore to manage data dynamically, for example, fetching user profiles, updating order statuses, or querying collections based on conditions.

Use Case Examples

  1. Retrieve a specific document by its path to get user details.
  2. Delete a document from Firestore by specifying its path.
  3. Set or replace a document's data at a given path.
  4. Update a document by merging new data with existing data at a specified path without overwriting the entire document structure, useful for partial updates like changing a user's email address or order status without affecting other fields in the document.

Properties

Name Meaning
Document Path The path to the Firestore document to get, delete, set, or update. It is specified without a leading slash and identifies the exact document location in Firestore.

Output

JSON

  • exists - Indicates if the document exists in Firestore (true or false).
  • id - The document ID in Firestore.
  • path - The full path of the document in Firestore.
  • data - The JSON data of the document when setting or updating.
  • wrote - Indicates a successful write operation when setting a document.
  • merged - Indicates a successful merge operation when updating a document.
  • deleted - Indicates a successful deletion of the document.
  • error - Error message if the operation fails and continueOnFail is enabled.

Dependencies

  • Firebase Admin SDK for Firestore

Troubleshooting

  • Ensure Firestore credentials are correctly configured and valid; missing or malformed credentials will cause initialization errors.
  • Private key must be correctly formatted; common errors include incorrect escaping of newlines or extra quotes around the key string.
  • If a document path does not exist, the node returns exists: false instead of throwing an error.
  • When using query operations, ensure conditions and orderBy fields are valid Firestore fields to avoid query errors.
  • If continueOnFail is not enabled, any error during execution will stop the workflow; enable it to handle errors gracefully.

Links

Discussion