Blog Post

Node.js SDK 2.0.0 Developer Preview

Brett Lawson of Couchbase Published

In addition to the recent SDKs releases, I am also glad to announce the release of a newly minted Node.js SDK as well!  This new major version of the Node.js SDK introduces a number of new features and bug fixes in addition to numerous performance and maintainability changes introduced through libcouchbase 2.4.0.

Check out a breakdown of the major changes:

  1. Creating a new bucket object now happens through a new Cluster type, making it easier than ever to open connections to multiple buckets contained within the same cluster!  In addition to the usage of this new method of instantiating bucket objects, the cluster bootstrap list (list of couchbase nodes) is now replaced with a powerful and flexible uri-like format.  Here's an example:
        var couchbase = require('couchbase');
        var cluster = new couchbase.Cluster('couchbase://10.1.1.2,10.1.1.1');
        var db1 = cluster.openBucket('default');
        var db2 = cluster.openBucket('thatotherbucket');
  2. Various bucket operations have been renamed to better reflect the document-oriented usage of Couchbase Server.
        db1.upsert('testdoc', {name:'Frank'}, ...);
  3. Support for SSL-encrypted communications with the cluster (More to come on this later).
        var couchbase = require('couchbase');
        var cluster = new couchbase.Cluster('couchbases://10.1.1.2,10.1.1.1');
        var db1 = cluster.openBucket('default');

Keep in mind that all of these changes are backwards compatible with 1.x versions of the Node.js SDK, so your applications will continue to function correctly with the improved performance of the newly updated internals.  However, in order to access any of the newer features, slight alterations to your code may be required.

Documentation

The documentation describing the full API is available to peruse here:

http://sdk-snapshots.couchbase.com/nodejs/nodejs_couchbase-2.0.0dp1-docs/

Get It

This release is published through npm as usual, however it is not tagged as a `latest` release, meaning you must specifically define this version when executing your npm install.  To specify this release, add `"couchbase": "2.0.0-dp1"` to your package.json, or execute:

npm install couchbase@2.0.0-dp1 --save

If you encounter any issues, please post directly to the Couchbase Communities site at http://www.couchbase.com/communities/nodejs. Additionally, bugs can be reported directly through our issues tracker available here: https://www.couchbase.com/issues/browse/JSCBC

I hope you enjoy!

Cheers! Brett