A newer version of this documentation is available.

View Latest
March 23, 2025
+ 12

How to extend the SQL++ query language by adding your own functions written in JavaScript.
This guide is for Couchbase Server.

Introduction

SQL++ includes a large number of operations and generic functions that cover every aspect of data manipulation. In addition to the built-in functions, Couchbase also allows you to create your own extensions to the language.

Using User-Defined Functions, you can:

  • Create reuseable, domain-specific functions for use in your applications.

  • Execute complex logic that may be difficult to do in SQL++.

  • Migrate from RDBMS stored procedures.

User-Defined Functions with JavaScript

JavaScript supported in Couchbase shares the same constructs of the ECMAScript. However, you should be aware of the restrictions and extensions that come with the Couchbase implementation. These are covered in JavaScript Functions with Couchbase

Next Steps

If you’re looking to create your own JavaScript libraries, then there are a number of guides to get you started.

If you wish to look into the constructs and available in the language itself, then you can have a look through the following pages: