Triggers in couchabse

Hi Everyone ,
Is it possible to have triggers in couchbase. for example perform an action if certain type of data in entered or a document with a certain key is update?

Could you put some logic(switch or case or pregmatch) in your app to do the actions for you before you get to the lines of GET , SET, REPLACE , or DELETE?

1 Answer

« Back to question.

Hello,

No, Couchbase server does not have any triggers. This is a choice of implementation. We do not want to have any business logic on the server side that could impact the performance (and resources)

So if you have some logic to do before/after your operations you must do it in your application.

This is very common in most of the NoSQL engine.

Regards
Tug
@tgrall

Thanks tgrall,
we have changed our design to do this in the application itself.
I was reading about the TAP protocol in couchbase so i thought it was possible

OK great !
Tug

Hi Tgrall
I have another question regarding locking in couchbase. in our application we have a service which is continuously processing documents from couchbase based on a status field in the document which is also indexed using the views. we are currently fetching each document with a waiting status using getwithlock in c# client and updating the status to processed and then processing the document. my question is if we multithread our application to process the documents because all the threads will be querying the same index if one thread does a getwithlock will the other threads just pick the next document available or wait for the lock to be released and pick up the same document?