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