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 https://www.npmjs.com/package/promise lib and would like to use the couchbase client lib with it.
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.
“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: http://jsperf.com/promise-comparisons/83
… 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.
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.
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.
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.