Actions7
- Document & Key-Value Actions
- Search Actions
Overview
This node integrates with a Couchbase database, enabling users to perform various operations on documents and key-value data within specified buckets, scopes, and collections. The "Upsert" operation for the "Document" resource allows users to insert a new document or update an existing one by specifying its ID and content. This is particularly useful in scenarios where you want to ensure that a document exists with certain data, regardless of whether it was previously created.
Practical examples include:
- Synchronizing user profile data where updates or inserts happen seamlessly.
- Maintaining configuration documents that may be created or updated dynamically.
- Logging events or transactions where each entry is uniquely identified by a document ID.
Properties
Name | Meaning |
---|---|
Couchbase Bucket | The target Couchbase bucket where the document resides. Can be selected from a list or entered by name. |
Couchbase Scope | The scope within the bucket to use. Selectable from a list or specified by name. |
Couchbase Collection | The collection inside the scope where the document will be upserted. Selectable or named. |
Document ID | The unique identifier of the document to create or update. Required for upsert operation. |
Document Value | The JSON content of the document to be stored or updated. |
Output
The output is a JSON array containing objects with the following structure:
[
{
"id": "document-id",
"value": { /* The JSON content of the document as stored */ }
}
]
id
: The document ID used in the upsert operation.value
: The JSON object representing the document's content after the upsert.
No binary data output is produced by this operation.
Dependencies
- Requires a valid connection to a Couchbase cluster using credentials (connection string, username, password).
- The node depends on the Couchbase SDK for Node.js to interact with the database.
- Proper configuration of the Couchbase bucket, scope, and collection must exist in the target database.
- An API authentication token or equivalent credential is required to connect securely.
Troubleshooting
- Connection Errors: If the node cannot connect to the Couchbase cluster, verify that the connection string, username, and password are correct, and that the Couchbase server is accessible and running.
- Bucket/Scope/Collection Not Found: Ensure that the specified bucket, scope, and collection exist in the Couchbase instance. Selecting them from the provided lists helps avoid typos.
- Invalid Document ID: The document ID must be a non-empty string. Empty or whitespace-only IDs will cause errors.
- Malformed JSON Document Value: The document content must be valid JSON. Invalid JSON input will cause the operation to fail.
- Permission Issues: The credentials used must have sufficient permissions to perform upsert operations on the specified collection.
Common error messages:
"Could not connect to database: ..."
indicates connectivity or authentication issues."Please select a bucket."
or"Scope 'X' not found in bucket 'Y'."
indicate misconfiguration of resource parameters.- Errors related to document insertion/upsertion usually stem from invalid IDs or malformed JSON.