Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Version tracking for couchdb views with cradle
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
test populate this.document correctly
README.markdown
index.js rollback condition was mixed up
package.json rollback condition was mixed up

README.markdown

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!

Something went wrong with that request. Please try again.