Couchbase icon

Couchbase

Couchbase node to insert, update, retrieve, and delete data from a Couchbase database using KV, Query and Search services

Actions7

Overview

This node allows executing SQL++ queries on a Couchbase database within an n8n workflow. It is designed to run arbitrary query statements against documents stored in Couchbase buckets and scopes, enabling flexible data retrieval and manipulation.

Common scenarios include:

  • Retrieving filtered or aggregated data from Couchbase documents using custom queries.
  • Running complex queries that join or filter data across collections.
  • Integrating Couchbase query results into automated workflows for reporting, data processing, or triggering downstream actions.

For example, you could use this node to run a query like SELECT * FROM users WHERE name="Michael" to fetch all user documents with the name Michael, then pass those results to other nodes for further processing.

Properties

Name Meaning
Couchbase Bucket The Couchbase bucket to query. Optional; if not specified, default context is used.
Couchbase Scope The scope within the bucket to query. Optional; refines the query context.
Run Query The SQL++ query string to execute against the selected bucket and scope.

Output

The output is a JSON array where each element corresponds to a row returned by the executed query. Each row is represented as an object with key-value pairs matching the fields selected in the query.

If no rows are found, the output will contain a single object with a message indicating "No results found".

There is no binary data output for this operation.

Example output JSON structure:

[
  {
    "field1": "value1",
    "field2": 123,
    ...
  },
  {
    "field1": "value2",
    "field2": 456,
    ...
  }
]

Dependencies

  • Requires a valid connection to a Couchbase cluster configured via credentials in n8n.
  • The node uses the official Couchbase Node.js SDK to connect and execute queries.
  • Proper permissions must be granted to the API key or authentication token to access the specified bucket and scope.
  • Optionally, environment variables or n8n credential configurations must provide connection details (host, username, password).

Troubleshooting

  • Could not access collection error: This indicates the specified bucket, scope, or collection does not exist or the credentials lack permission. Verify the names and permissions.
  • Query syntax errors: Ensure the SQL++ query string is valid and correctly formatted.
  • Empty results: If no documents match the query, the output will indicate "No results found".
  • Connection issues: Check network connectivity and Couchbase server availability.
  • Missing bucket or scope: If these are not specified, the query context defaults to the cluster default. Specify them explicitly if needed.

Links and References

Discussion