Skip to main content
Version: 3.0

Couchbase Nodes

Read and write Couchbase documents by key, with optimistic locking through CAS, and query them with read-only SQL++.

Operations
Get · Upsert · Replace · Remove Document · Run Query
Locking
CAS, delivered and taken as text
Query
Read-only, parameters as values, Max Rows applied by Couchbase

Couchbase keeps JSON documents in collections of a bucket. MaestroHub provides five nodes: four that work on one document by its key, and Run Query for SQL++. All use a Couchbase connection, which names the bucket; each function names its scope and collection.

Configuration Quick Reference​

FieldWhat you chooseDetails
ParametersConnection, Function, Function Parameters, Timeout OverrideSelect the connection profile, function, configure function parameters with expression support, and optionally override timeout.
SettingsDescription, Timeout (seconds), Retry on Timeout, Retry on Fail, On ErrorNode description, maximum execution time, retry behavior on timeout or failure, and error handling strategy. All execution settings default to pipeline-level values.
Couchbase Get Document NodeCouchbase Get Document Node

Couchbase Get Document Node

Couchbase Get Document Node​

Function NamePurposeCommon Use Cases
Get DocumentRead the document at key in scope.collection, with its CASThe latest state of a machine, a recipe or a work order by its ID; the read before a conditional Replace

A key with no document is a normal result with found false: branch on it rather than catching an error.

Couchbase Upsert Document NodeCouchbase Upsert Document Node

Couchbase Upsert Document Node

Couchbase Upsert Document Node​

Function NamePurposeCommon Use Cases
Upsert DocumentWrite document to key, creating or overwriting it, with an optional expiry and durability levelOne document per machine with its latest state, shift logs, configuration snapshots

Writing the same document to the same key again leaves the same state, so the node is eligible for store-and-forward: writes made while Couchbase is unreachable are applied in order per key when it returns.

Couchbase Replace Document NodeCouchbase Replace Document Node

Couchbase Replace Document Node

Couchbase Replace Document Node​

Function NamePurposeCommon Use Cases
Replace DocumentOverwrite the document at key only if it exists, and only at cas when one is givenRead-modify-write without overwriting a concurrent change: work orders, counters kept in a document

A CAS mismatch or a missing document fails the node and writes nothing. The node is never buffered by store-and-forward, because a CAS read before an outage would be stale by the time a replay ran.

Couchbase Remove Document NodeCouchbase Remove Document Node

Couchbase Remove Document Node

Couchbase Remove Document Node​

Function NamePurposeCommon Use Cases
Remove DocumentRemove the document at key, optionally only at casClosing a finished work order, clearing a buffer entry once it was forwarded

Removing a key with no document succeeds with removed false, so a repeated remove changes nothing.

Couchbase Run Query NodeCouchbase Run Query Node

Couchbase Run Query Node

Couchbase Run Query Node​

Function NamePurposeCommon Use Cases
Run QueryRun the SQL++ statement in scope with its args, and return at most maxRows rowsMachines in alarm on a line, alarm counts before a decision, documents changed since a time

Every statement is sent read-only: Couchbase refuses one that writes. Values go as query parameters ($1 or $name), never spliced into the statement. At Max Rows the read stops and Couchbase ends the query; with Scan Consistency requestPlus the query sees every write made before it.


Output​

Every Couchbase node delivers its data under result, and execution facts (success, functionId, durationMs, timestamp) under _metadata:

NodeExpressionDescription
Get Document$node["Name"].result.keyThe key that was read
$node["Name"].result.foundWhether a document exists at that key
$node["Name"].result.documentThe document as stored, or null when found is false. $node["Name"].result.document.state reads a field
$node["Name"].result.casOnly when found: the document's CAS as decimal text, for a later Replace or Remove
Upsert Document, Replace Document$node["Name"].result.keyThe key that was written
$node["Name"].result.casThe document's new CAS as decimal text
Remove Document$node["Name"].result.keyThe key that was removed
$node["Name"].result.removedWhether a document was removed: false when none existed at the key
$node["Name"].result.casOnly when removed: the CAS of the removal as decimal text
Run Query$node["Name"].result.rowsThe rows as the query returned them: an object per row, or a bare value for SELECT RAW. $node["Name"].result.rows[0].machine reads a field
$node["Name"].result.rowCountHow many rows were delivered
$node["Name"].result.truncatedtrue when the query had more rows than Max Rows and the read stopped there

A CAS is a 64-bit number, larger than a JSON number holds exactly, so it is always text: pass it on as it is, never through arithmetic.

The call's own facts ride along under _metadata next to the four every connected node carries: _metadata.method (the operation), _metadata.connectionId, _metadata.protocol (couchbase) and _metadata.bucket on every node; _metadata.scope on every node, and _metadata.collection on the four document nodes; after Run Query, _metadata.maxRows, the row limit it ran with.