npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cushion-adapter-couchbase

v0.2.1

Published

An adapter for connecting Couchbase to Couch Cushion ODM

Downloads

30

Readme

Cushion Adapter Couchbase Build Status Analytics

An adapter for connecting to a Couchbase DB through Couch-cushion

Installation

npm install --save cushion-adapter-couchbase
var cushion = require('couch-cushion'),
    adapter = require('cushion-adapter-couchbase');

cushion.install(adapter);
cushion.connect({ /* adapter config */ });

Configuration

Configuration is initially done through the connect function, which passes the options on to the adapter.

Configuration Options

{
    host:       undefined,  // The host that the CB cluster is located on
    bucket:     'default',  // The bucket name to connect to

    bucketPass: null,       // If there is a password on the bucket


    // Optional, timeouts for different operations.
    // See CB docs for details

    connectionTimeout:  undefined,
    opartionTimeout:    undefined,
    opartionTimeout:    undefined,
    managementTimeout:  undefined,

    // N1ql server endpoints to be enabled via:
    // bucket.enableN1ql(/* ... */)

    n1qlEndpoints:      undefined,
}

Mock Interface

The adapter can be setup to use Couchbase SDK's mock interface for testing.

var cushion = require('couch-cushion'),
    adapter = require('cushion-adapter-couchbase');

cushion.install(adapter.Mock); // Install Mock adapter
cushion.connect({ /* adapter config */ });

Couch Cushion Methods and Properties

After installing the Couchbase adapter a number of new properties and methods become available to the base CouchCushion object. The new methods and properties are to ease the process of communicating with Couchbase through the adapter.

Properties

Cb / Couchbase:

Allows access to the same Couchbase instance used by the adapter.

ex: cushion.Cb / cushion.Couchbase

Methods

CouchCushion.getOne(model, cb, search[, key[, doc[, db]]])

Gets a single model from Couchbase using a query. The method accepts either an already constructed query or arguments that can be used to create a query. The result that is returned is the first doc that Couchbase returns.

Ex:

var cb = function(err, model, res) {
    /* ... */
}

// Using a query
var query = cushion.CB.ViewQuery
    .from('userDesignDoc', 'by_username')
    .key('jfelsinger');

cushion.getOne('User', cb, query);

// Using parts of a query
cushion.getOne('User', cb, 'by_username', 'jfelsinger', 'userDesignDoc');

CouchCushion.getMany(model, cb, search[, key[, doc[, db]]])

Same as above, but returns an array of objects.

Ex:

var cb = function(err, models, res) {
    /* ... */
}

// Using a query
var query = cushion.CB.ViewQuery
    .from('userDesignDoc', 'by_status')
    .key('online');

cushion.getOne('User', cb, query);

// Using parts of a query
cushion.getMany('User', cb, 'by_status', 'online', 'userDesignDoc');

CouchCushion.fromQuery(model, cb, query[, db])

Gets an array of models from a query, much like getMany().

Ex:

// Using a query
var query = cushion.CB.ViewQuery
    .from('userDesignDoc', 'by_status')
    .key('online');

cushion.fromQuery('User', cb, query);

CouchCushion.oneFromQuery(model, cb, query[, db])

Gets a single model from a query, much like getOne().

Ex:

// Using a query
var query = cushion.CB.ViewQuery
    .from('userDesignDoc', 'by_username')
    .key('jfelsinger');

cushion.oneFromQuery('User', cb, query);

CouchCushion.fromView(model, cb, view, key, doc[, db[, isMultiKey]])

Gets an array of models from a view query, much like getMany().

Ex:

cushion.fromView('User', cb, 'by_status', 'online', 'userDesignDoc');

CouchCushion.oneFromView(model, cb, view, key, doc[, db[, isMultiKey]])

Gets a single model from a view query, much like getOne().

Ex:

cushion.oneFromView('User', cb, 'by_username', 'jfelsinger', 'userDesignDoc');

CouchCushion.rawQuery(query, cb[, *db])

Gets the raw results of a query, similar to calling bucket.query.

Ex:

// Using a view-query
var query = cushion.CB.ViewQuery
    .from('userDesignDoc', 'by_username')
    .key('jfelsinger');

cushion.rawQuery(query, cb);


// Using an n1ql query-string
query = "SELECT * FROM default WHERE name='test'";

cushion.rawQuery(query, cb);