Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including atto with all npm packages installed. Try it out:

var atto = require("atto")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

atto v0.1.3

A minimalist Couchbase driver


Atto is a minimalist Couchbase driver.

What does Atto do?

Atto lets you use Couchbase's memcached protocol to work with documents. Atto also supports HTTP views.

Atto automatically detects HTTP nodes. The implementation isn't very rich at this point, but it will get better in future releases.

What doesn't Atto do?

There is no way to create views from Atto.

Atto is not a "smart" memcached client. It won't automatically connect to multiple memcached servers. I suggest using Moxi, which ships with Couchbase.

API reference

Installation is simple.

$ npm install atto

Creating the object

var db = require('atto')(memcachedPort, memcachedHost, dbHost, bucketName, bucketUsername, bucketPassword)


Callbacks should be in the following format:

function(error, response) {}


db.set(key, value, cb[, lifetime]);


db.get(key, cb);

Response: An object if the value is valid JSON. Otherwise, the response is a string.

Increment, value, cb);

Response: The incremented value.


db.dec(key, value, cb);

Response: The decremented value.


db.view(designDoc, viewName, params, cb);

The first two parameters are strings. params should be an object (for querystring):

    key: 'documentKey',
    limit: 10

Response: Unmodified JSON from the HTTP request.


  • Optional bucket authentication (required right now)
  • More memcached functions


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free