Examples: Using the Eventing Service

  • Capella Operational
    March 23, 2025
    + 12

    This page contains examples of how to use the Eventing Service with the Couchbase Web Console.

    Step-by-Step Examples

    Scriptlets

    Basic SQL++ Eventing Functions

    The following scriptlets demonstrate how to use SQL++ or the Query Service with an Eventing Function.

    basicN1qlSelectStmt

    basicN1qlPreparedSelectStmt

    Generic Manipulation Eventing Functions

    The following scriptlets are examples of advanced use cases that focus on mutating a document without knowing that document’s schema.

    dateToEpochConversion

    deepCloneAndModify

    removeObjectStubs

    removeNullsAndEmptys

    genericRename

    genericFlatten

    convertXMLtoJSON

    convertAdvXMLtoJSON

    Advanced Accessor Eventing Functions

    The following scriptlets demonstrate how to use Advanced Keyspace Accessors, which allow you to:

    • Use CAS

    • Set expiry (TTL) dates

    • Use distributed atomic counters to increment and decrement counts

    advancedGetOp

    advancedGetOpWithCache

    advancedInsertOp

    advancedUpsertOp

    advancedReplaceOp

    advancedDeleteOp

    advancedIncrementOp

    advancedDecrementOp

    advancedTouchOp

    advancedKeepLastN

    advancedDocControlledSelfExpiry

    multiCollectionEventing

    advancedSelfRecursion

    advancedMutateInField

    advancedMutateInArray

    advancedLookupInField

    Binary Document Support

    The following scriptlets demonstrate support for binary documents in Eventing.

    Your Eventing Function must have a language compatibility setting of Couchbase Server version 6.6.2 or above to pass binary documents in its OnUpdate(doc,meta) handler.

    basicBinaryKV

    advancedBinaryKV

    Performance Eventing Functions

    The following scriptlets are examples of performance-oriented or benchmark Eventing Functions.

    fasterToLocalString