transactions-nodejs
Installation
SKILL.md
Couchbase Transactions — Node.js
ACID multi-document transactions. All operations commit atomically or roll back entirely.
Version requirement: Distributed transactions require Couchbase Server 7.0+. The 6.6 developer preview is not recommended for production.
Bank Transfer Example
await cluster.transactions().run(async (ctx) => {
const sender = await ctx.get(collection, 'acct_alice');
const receiver = await ctx.get(collection, 'acct_bob');
const senderDoc = sender.content;
const receiverDoc = receiver.content;
if (senderDoc.balance < amount) throw new Error('Insufficient funds');