Cloud Firestore Connection icon

Cloud Firestore Connection

Interage com o Google Cloud Firestore

Actions4

Overview

This node integrates with Google Cloud Firestore, a NoSQL document database, allowing users to create, read, update, or delete documents within their Firestore database. Specifically, the Create Document operation enables users to add new documents to a specified collection path, optionally generating random document IDs.

Common scenarios where this node is beneficial include:

  • Automating data entry into Firestore from other workflows.
  • Creating structured records dynamically based on incoming data.
  • Generating unique document IDs automatically when needed.
  • Managing Firestore documents without writing custom code.

For example, you can use this node to create user profiles in Firestore by specifying the collection path and providing key-value pairs for user attributes like name, email, and signup date.


Properties

Name Meaning
Project Name or ID The Google Cloud project identifier where the Firestore database resides.
Path The Firestore document path where the new document will be created. Supports nested collections. Use {id} in the path to generate a random document ID. Example: /users/{id}.
Document The data fields of the document to create. This is a collection of key-value pairs, each with a type. Supported types are: String, Number, Boolean, Map (Object), Array, Null, Timestamp, GeoPoint, Reference.

Output

The output JSON contains information about the created document:

  • id: The unique identifier of the created document.
  • path: The full Firestore path to the created document.

Example output JSON:

{
  "id": "autoGeneratedOrSpecifiedId",
  "path": "collection/documentId"
}

If an error occurs during creation and "Continue On Fail" is enabled, the output will contain an error field describing the issue.


Dependencies

  • Requires a valid Google Cloud Firestore API credential with appropriate permissions.
  • The node expects a service account JSON credential containing client_email and private_key.
  • The Google Cloud project must have Firestore enabled.
  • The node uses the official @google-cloud/firestore library internally.

Troubleshooting

  • Invalid Service Account JSON: If the provided service account JSON is malformed or invalid, the node throws an error indicating the JSON is invalid. Ensure the JSON is correctly copied and formatted.
  • Invalid Path Format: When using {id} in the path, the path must be in the format collection/{id} or deeper nested collections but must not end abruptly. An invalid path will cause an error.
  • Permission Errors: Insufficient permissions on the Google Cloud project or Firestore database will result in authentication or authorization errors.
  • JSON Parsing Errors: For complex types like Map or Array, the value must be valid JSON. Invalid JSON strings will cause parsing errors.
  • Document Creation Failures: Network issues or Firestore service outages may cause failures; retry or check connectivity.
  • Document ID Generation: If {id} is used in the path, the node generates a random document ID. Omitting {id} means the path must specify the full document ID.

Links and References

Discussion