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 perform CRUD operations on Firestore documents. Specifically, the Update Document operation updates an existing document at a specified path with new data.

Common scenarios for this node include:

  • Modifying user profiles or settings stored in Firestore.
  • Updating order statuses or inventory details in real-time applications.
  • Syncing external data sources by updating Firestore documents accordingly.

For example, you might update a user's document to change their subscription status or add a timestamp of their last login.

Properties

Name Meaning
Project Name or ID The Google Cloud project identifier where the Firestore database resides.
Path The full path to the Firestore document to update, e.g., collection/documentId/subcollection/{id}.
Document The data fields to update in the document. Each field includes:
- Key The name of the document field to update.
- Value The value to set for the field.
- Type The data type of the value. Options include: String, Number, Boolean, Map (Object), Array, Null, Timestamp, GeoPoint, Reference.

Output

The output JSON for the Update operation contains:

  • success: A boolean indicating if the update was successful (true).
  • path: The full Firestore path of the updated document.

Example output:

{
  "success": true,
  "path": "collection/documentId"
}

No binary data is produced by this node.

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 Firestore client library from @google-cloud/firestore is used internally.
  • The Google Cloud project ID must be provided.

Troubleshooting

  • Invalid Service Account JSON: If the service account JSON is malformed or invalid, the node will throw an error stating "O JSON da Conta de Serviço é inválido." Ensure the JSON is correctly formatted and complete.
  • Invalid Path for Creation with {id}: When creating documents with {id} placeholder, the path must be a collection path like collection/{id}. Otherwise, an error "Caminho inválido para criação com {id}. Deve ser 'colecao/{id}'." is thrown.
  • Document Not Found: For read or update operations, if the document does not exist at the specified path, an error "Documento não encontrado em: [path]" is raised.
  • JSON Parsing Errors: When specifying complex types like Map or Array, ensure the JSON string is valid; otherwise, an error "JSON inválido para a chave '[key]': [value]" occurs.
  • Permission Issues: Make sure the service account has Firestore access rights for the specified project.

If the node is configured to continue on failure, errors are returned as part of the output JSON under the error key.

Links and References

Discussion