Overview

The Couchbase Node.js SDK, previously known as Couchnode, enables you to interact with Couchbase Server from a Node.js application.

The Node.js SDK consists of a native JavaScript library and a C/C++ add-on that uses the Couchbase C SDK (libcouchbase) internally. The SDK includes the following components:

  • Couchnode client
  • Developer guide (you're reading it now!)
  • Couchnode API reference
  • Sample applications (beer database, CouchQA)

Architecture

To debug errors, you must be familiar with the Couchnode architecture to understand where problems might originate. The following components participate in typical operations:

  • Couchbase Server

    This is the server itself, which stores your data. Errors can happen here if your data does not exist, or if there are connectivity issues with one or more nodes in the server. While Couchbase Server is scalable and fault tolerant, there are naturally some conditions that cause failures (for example, if all nodes are unreachable).

  • libcouchbase

    libcouchbase, our C client library, provides the underlying layer that handles network communication and protocol handling between a client and a Couchbase node. Network connectivity issues tend to happen here.

  • Node.js C++ binding layer

    The binding layer contains the C++ code that provides the bulk of the SDK. It interfaces with the libcouchbase component, handles marshaling of information between libcouchbase and your application, performs input validation, and encoding and decoding of keys and values.

  • Node.js layer

    The Node.js layer is written in pure JavaScript. Simple key-value operations are normally just dispatched to the C++ layer. Most of the view operations are handled here as well, with the C++ binding layer just performing the lower-level network handling.

Compatibility

To take advantage of all features offered by Couchbase Server, you need to know what version of Couchnode provides compatibility for the features you want to use. The following matrix shows which versions of Couchnode support the major features of each version of Couchbase Server.

Table 1. Couchbase Server and SDK Supported Version Matrix
  Server 1.8 Server 2.0 Server 2.5 Server 3.0
Basic Features
CRUD Operations Since 1.0
View Querying APIs Since 1.0
Advanced Features
Durability Requirements Since 1.0
Fast (CCCP) Bootstrapping Not Supported Since 1.2
SSL Connectivity Not Supported Since 2.0
Transparent Compression Not Supported Since 2.0
Bulk Operations Since 1.0
Cross-SDK Data types Not Supported Since 2.0
N1QL Querying Since 1.2
Administrative Features
Administrative API Since 1.0

Contributing

Couchbase welcomes community contributions to the Node.js SDK. The Couchnode source code is available on GitHub. If you would like to contribute code, read the contributor's guide for details.