Actions7
- Document & Key-Value Actions
- Search Actions
Overview
This node enables interaction with a Couchbase database, specifically allowing users to perform operations on documents stored within Couchbase buckets, scopes, and collections. The "Read" operation for the "Document" resource retrieves a document by its ID from a specified bucket, scope, and collection.
Common scenarios where this node is beneficial include:
- Fetching configuration or user data stored as JSON documents in Couchbase.
- Retrieving specific records for processing or integration workflows.
- Accessing cached data or session information stored in Couchbase.
For example, you might use this node to read a user profile document by its unique ID from a particular collection, then use that data downstream in your workflow for personalization or analytics.
Properties
| Name | Meaning |
|---|---|
| Couchbase Bucket | The Couchbase bucket to access. Can be selected from a list or specified by name. |
| Couchbase Scope | The scope within the bucket to use. Depends on the selected bucket. |
| Couchbase Collection | The collection within the scope to use. Depends on the selected bucket and scope. |
| Document ID | The unique identifier of the document to read from the specified collection. |
Output
The output is a JSON array where each item corresponds to a document retrieved or affected by the operation. For the "Read" operation on a document, the output structure includes:
id: The document ID requested.value: The content of the document serialized as a JSON string.
Example output JSON for a successful read:
[
{
"id": "my-document-ID",
"value": "{\"field1\":\"value1\",\"field2\":42}"
}
]
No binary data output is produced by this operation.
Dependencies
- Requires a valid connection to a Couchbase cluster using an API key credential configured in n8n.
- The node depends on the Couchbase SDK (
couchbasenpm package) for database interactions. - Proper permissions must be granted to the credentials to access the specified bucket, scope, and collection.
- The node uses utility functions to validate bucket, scope, and collection existence before performing operations.
Troubleshooting
- Could not access collection: This error indicates that the specified bucket, scope, or collection does not exist or the credentials lack permission. Verify the names and ensure the API key has sufficient rights.
- Document not found: If the document ID does not exist, the node may return an empty result or an error depending on Couchbase behavior. Confirm the document ID is correct.
- Connection issues: Ensure the Couchbase cluster is reachable and the credentials are valid.
- Invalid JSON in document value: When reading, the document content is serialized as JSON. If the document contains non-serializable data, it may cause issues downstream.