dirtkey

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

npm install dirtkey
4 downloads in the last month

node-dirtkey

Purpose

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

Installation

npm install dirtkey

Why 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.

Usage

var dirtkey = require('dirtkey');
var dirtkeyConf = new(dirtkey.conf)({host:'127.0.0.1',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'));
})

License

node-dirtkey is licensed under the MIT license.

npm loves you