A dirty and cradle inspired fast key value store for CouchDB.


A Dirty (https://github.com/felixge/node-dirty) and Cradle (https://github.com/cloudhead/cradle) inspired fast key value store for CouchDB.

npm install dirtkey

This module is a simple key-value store for Node on the Couch.

  • A single couch document is a simple key-value database.
  • The key is stored in the '_id', and value is stored in 'val'.
  • There is no query language, you just forEach through all records.
  • Dirtkey uses the same event emitter pattern as node-dirty.
  • Not file based, therefore no need to worry about git overwrites.
var dirtkey = require('dirtkey');
var dirtkeyConf = new(dirtkey.conf)({host:'',port:'5984',db:'myappdb'});

// load, read and iterate records
var appDb = dirtkey('app.db');
appDb.on('load', function() {
    appDb.forEach(function(key, val) {
        console.log('Found key: %s, val: %j', key, val);

// write
appDb.set('rec1',{field1:'value',field2:'anothervalue'}, function() {
    console.log('Added %s.', appDb.get('app'));

node-dirtkey is licensed under the MIT license.