Couchbase
Run N1QL queries and upsert documents in Couchbase.
On this page
Connect
Auth type: Credentials form (custom_auth). Fill in the fields the provider needs (listed below). They are stored encrypted in the vault.
| Field | Type | Description |
|---|---|---|
connectionStringrequired | text | Couchbase connection string (e.g. couchbase://localhost) |
usernamerequired | text | Cluster username |
passwordrequired | secret | Cluster password |
bucketNamerequired | text | Default bucket to operate on |
- In the editor: Backend panel, Integrations tab, then Connect. This connects it for the project.
- For every project in a workspace: Workspace settings, Integrations.
- Owners and admins choose which integrations members may connect in the admin panel (Integrations tab), and can attach their own OAuth app there.
Call it from a workflow
Pass the action name and its input. The call resolves with { success, output, error? }; a missing connection resolves with success false and the reason. See ctx.integrations.invoke and ctx.integrations.call.
// .workflow.js (native ctx)
export async function run(ctx) {
const res = await ctx.integrations.invoke("couchbase", "upsert_document", {
"bucket": "<bucket>",
"document": {}
});
if (!res.success) throw new Error(res.error);
ctx.log.info("Couchbase answered", { output: res.output });
}// defineWorkflow module (@app/sdk ctx)
import { defineWorkflow } from "@app/sdk";
export default defineWorkflow({
id: "couchbase-upsert-document",
name: "Couchbase: Upsert Document",
description: "Calls Couchbase when a row is created.",
trigger: { type: "entity_event", entity: "tickets", event: "created" },
async run(ctx, event) {
const res = await ctx.integrations.call("couchbase", {
"action": "upsert_document",
"bucket": "<bucket>",
"document": {}
}) as { success: boolean; error?: string };
if (!res.success) throw new Error(res.error);
},
});curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/couchbase/upsert_document" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"bucket":"<bucket>","document":{}}}'Actions
upsert_documentin catalog
Upsert Document. Create or update a document. Creates if it doesn't exist, updates if it does.
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdoptional | text | Unique identifier for the document. Leave empty to auto-generate. |
documentrequired | JSON | The JSON document to store |
expiryoptional | number | Document expiration time in seconds. Leave empty for no expiry. |
durabilityLeveloptional | one of "0" | "1" | "2" | "3" | How durable the write should be before returning success |
timeoutoptional | number | Operation timeout in milliseconds |
delete_document
Delete Document. Remove a document by its ID
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdrequired | id (picked from your account) | Select an existing document or type a custom ID |
durabilityLeveloptional | one of "0" | "1" | "2" | "3" | How durable the write should be before returning success |
timeoutoptional | number | Operation timeout in milliseconds |
get_document
Get Document. Retrieve a document by its ID
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdrequired | id (picked from your account) | Select an existing document or type a custom ID |
timeoutoptional | number | Operation timeout in milliseconds |
insert_document
Insert Document. Create a new document. Fails if document already exists.
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdoptional | text | Unique identifier for the document. Leave empty to auto-generate. |
documentrequired | JSON | The JSON document to store |
expiryoptional | number | Document expiration time in seconds. Leave empty for no expiry. |
durabilityLeveloptional | one of "0" | "1" | "2" | "3" | How durable the write should be before returning success |
timeoutoptional | number | Operation timeout in milliseconds |
query
Execute SQL++ Query. Run a SQL++ (N1QL) query with optional vector search filters
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
queryrequired | long text | SELECT statement with optional positional parameters ($1, $2, etc.). Do not include LIMIT or OFFSET. |
argumentsoptional | array | Values for positional parameters ($1, $2, etc.) in the query |
vectorFiltersoptional | array | Filter results by vector similarity (requires vector index) |
vectorOrderoptional | array | Order results by vector similarity (requires vector index) |
limitoptional | number | Maximum number of results to return |
offsetoptional | number | Number of results to skip |
scanConsistencyoptional | one of "not_bounded" | "request_plus" | Query consistency level |
timeoutoptional | number | Operation timeout in milliseconds |
Details
- Id
couchbase- Category
- Data and storage
- Tags
- database, nosql, document, distributed
- Package
@activepieces/piece-couchbase@0.1.4- Tier
- Community