Couchbase Functions

Functions Overview

Couchbase Functions, also termed as Functions, are server-side computing paradigms which handle data mutations according to an Event-Condition-Action model. Functions offer a platform for developing code, known as Function handler code, as a response to data mutations to the data residing in Couchbase cluster.

As a developer, you can use Functions for stateless, seasonal, asynchronous, and low-latency type of workloads. Functions are simple, easy to use, easy to port and can handle scaling complexities without having to change any existing infrastructure and configurations on your data platform. By keeping infrastructure and configuration changes to minimum, you can move the serverless computing infrastructure closer to the datastore.

Language Constructs

To support requirement in Couchbase Functions, three new constructs are added and three of the existing JavaScript constructs are removed.

Following language constructs have been added.

Following language constructs have been removed.

Function Handler Code

Handler code is a short-running code-fragment that reacts to an event. For more information refer to the Function Handler Code section.

Supported Operations

Following operations are supported inside a Function handler code.

  • Bucket Operations

  • N1QL Queries

  • Timers

Refer to Supported Operations section for details.

Function Lifecycle Operations

The Eventing Service offers various Function related operations, see Lifecycle Operations.

Examples

The Examples section provides four distinct examples for the Eventing Service.