0.0.1 • Published 13 years ago

grave v0.0.1

Weekly downloads
6
License
-
Repository
github
Last release
13 years ago

grave

Manage versioning and updates of your couchdb design documents while using cradle.

var client = require('grave').connect('localhost', 5984);
var db = client.db('webshizzle');

var design = db.design('users', '0.0.2');

design.view('all', {
    map : function (doc) {
        if (doc.type === 'user') emit(doc._id, doc);
    },
});

design.end();

Manny Calavera rocking the cradle

methods

grave.connect(...)

Pass through arguments to cradle.Connection and return a new "client" handle.

client.db(dbname)

Return a cradle database handle with an extra method, db.design().

db.design(name, version)

Start a design with a name and a version. Theversion should be understood by semver.

design.view(name, view)

Define a couchdb view. CouchDB views have map, reduce, and fields of that sort.

design.list(name, list)

Define a couchdb list. CouchDB lists are functions that look like function (head, req) { /* ... */ }.

design.update(name, update)

Define a couchdb update. These look like function (doc, req) { /* ... */ }.

design.end(cb)

Declare the end of the design document definitions and save them to couchdb when the design version is greater than the couchdb version.

kudos

tanepiper came up with this idea. It's all his fault!