Manage documents using server-side javascript function


#1

I would like to know if couchbase server, or sync gateway, support server-side execution of custom logic.

I mean, if I can use sync_function (or any javascript function in the server) to edit a new document that is received, before it’s stored.

Thanks.


#2

Hello,

No you cannot add serverside logic in the current release Couchbase Server. The main reason is -predictable- performance, if you start to add such logic in the server it may impact the performance.

For the Sync Gateway you have:

  1. data routing to channels. channel access control. This is the sync function
  2. asynchronous workers – eg a server process that follows the changes feed for a few channels and does work based on what documents come through changes.

You can find example of this here:

Regards
Tug
@tgrall