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 integrates with a Couchbase database to perform operations on documents stored within specified buckets, scopes, and collections. The Create operation for the Document resource allows users to insert new JSON documents into a Couchbase collection. Users can either specify their own document ID or let the node generate a unique ID automatically.

Common scenarios where this node is beneficial include:

  • Inserting new records or entities into a Couchbase database as part of an automated workflow.
  • Creating documents with custom IDs for easy retrieval later.
  • Automating data ingestion pipelines that require storing structured JSON data in Couchbase.

Practical example:

  • A workflow that collects user feedback from a form and stores each submission as a new document in a Couchbase collection, optionally using a user-defined ID or generating one automatically.

Properties

Name Meaning
Couchbase Bucket The target Couchbase bucket where the document will be created. Can be selected from a list or entered by name.
Couchbase Scope The scope within the bucket to use. Depends on the selected bucket. Selectable from a list or entered by name.
Couchbase Collection The collection inside the scope where the document will be inserted. Depends on bucket and scope selection.
Specify Document ID Boolean flag indicating whether to use a user-specified document ID (true) or generate a new one (false).
Document ID The ID to assign to the new document. Required if "Specify Document ID" is true.
Document Value The content of the document in JSON format to be stored in Couchbase.

Output

The output is a JSON array containing objects with the following structure:

[
  {
    "id": "document-id",
    "value": { /* The JSON content of the created document */ }
  }
]
  • id: The document ID used for the newly created document (either user-specified or auto-generated).
  • value: The JSON object representing the document content that was inserted.

No binary data output is produced by this operation.

Dependencies

  • Requires a valid connection to a Couchbase cluster, authenticated via an API key credential configured in n8n.
  • The node depends on the Couchbase SDK and UUID library for generating document IDs.
  • The Couchbase bucket, scope, and collection must exist and be accessible with the provided credentials.
  • Proper permissions are required to insert documents into the specified collection.

Troubleshooting

  • Error: Could not access collection
    This error indicates that the specified bucket, scope, or collection does not exist or the credentials lack sufficient permissions.
    Resolution: Verify that the bucket, scope, and collection names are correct and that the API key has write access.

  • Invalid JSON in Document Value
    If the JSON content provided in "Document Value" is malformed, the insertion will fail.
    Resolution: Ensure the JSON is well-formed and valid before running the node.

  • Duplicate Document ID Error
    When specifying a document ID manually, if a document with the same ID already exists, the insert operation will fail.
    Resolution: Use the upsert operation to overwrite existing documents or ensure unique IDs when creating.

  • Connection Issues
    Failure to connect to the Couchbase cluster may occur due to network issues or incorrect credentials.
    Resolution: Check network connectivity and verify the API key configuration in n8n.

Links and References

Discussion