A node.js document store with the ability to load from and save to a file, record collection changes in a swapfile and last, but not least, perform basic CRUD operations on collections.
npm install --save git+https://github.com/christian-raedel/node-cstore.git#v0.2.0
cd /path/to/node-cstore
make install test
cd /path/to/node-cstore
make install docs
$BROWSER doc/index.html
var CStore = require('node-cstore');
var ds = new CStore({name: '$appleStore'})
.addModel(new CStore.CModel({name: '$macBooks'}));
ds.getModel('$macBooks')
.insert({
name: 'Mac Book Pro', description: 'Some appraisals', price: 2700
})
.insert({
name: 'Mac Book Air', description: 'Some more appraisals', price: 1800
});
var model = ds.getModel('$macBooks')
, docs1 = model.find({price: 2700})
, docs2 = model.find({price: {'$gt': 1700}})
, docs25= model.find({price: {'$gt': 1700}, description: {'$in': 'appraisals'}})
, docs3 = model.find({'$or': {price: {'$eq': 2700}, price: {'$eq': 1800}}});
model.update({price: 2700}, {description: 'extra vaganza'});
model.delete({price: 1800});