Couchbase Node.js Client Library returning promises

Is there a version of the official Couchbase Node.js Client Library except that the result of every operation is a promise to avoid nested callbacks?
We are using the lib and would like to use the couchbase client lib with it.

Thanks a lot

Hey AleCaste,

We do not directly support any type of promise library, however most of them are capable of wrapping the callback oriented nature of the Couchbase SDK without much trouble.

Cheers, Brett

Hello @AleCaste,

I started to work on a library that wraps the callbacks and returns promises. It is in very early stage now, but you can take a look at it and send me feedback and feature requests here:

Hope this helps,

1 Like

Hello György,
This is very good news indeed.
I’ll have a look at the library in the next few days.
By the way György, I can see you’re using Blueprint; have you consider using kew instead?
Q is the most widely used library for promises (even Angular uses a light version of it) and kew uses its syntax but is much faster and much smaller in terms of file size.
More info here:

Hello @AleCaste,

Thanks for the link.

I have chosen Bluebird mainly because of performance reasons. According to

“Bluebird is 2 orders of magnitude (~100x) faster with more features and with the shared features being better, for example full stack traces. It also uses 20x less memory. Memory usage and performance alone is reason enough if you are using promises at server side.”


That’s not true. Of course the authors can claim whatever they want but test results can tell us differently.
See this:
… kew is 200% faster than bluebird in -for example- latest versions of Firefox and Safari.
That is a lot.
But not only that… bluebird is way bigger in terms of library size (almost 10 times bigger).
So there you go. Authors can claim whatever they want.
Having said that, bluebird will do just fine for the purpose, of course it will.

Hello @AleCaste,

Thanks for the link. I agree, the authors can claim whatever they want, and you can find various benchmarks. I plan to use this library in Node.js environment, but to be honest, I personally didn’t do any benchmarks for it.


Hello György,
In the end I have decided to avoid promises as much as I can and use generators.
There are flow-control libraries that use generators like co, which allows programs to be written almost as traditional synchronous code making for far more readable and supportable code.
The only thing is that you need to have node version 0.11.x or higher and must use --harmony-generators flag when running node.
See this:

By the way, we didn’t know there are loads of libraries that use co already, including co-couchbase
Maybe you alreaday knew about co and all this… but we didn’t !!!
What a discovery

Thanks a lot for the library! We will have a look at it.
Indeed promises can be yielded too so this lib could be an option when using Couchbase.
Thing is that as much as I like Couchbase, the company has decided not to use nosql databases for now.
Thanks again

Rolling your own Couchbase Node.js Promises is also an option, it’s very easy.

Here’s a blog post that details an approach using the Q library that wraps the official Couchbase SDK.