A perstore interface that persists data using MongoDB
var MongoStore = require('mongo-perstore'),
MongoClient = require('mongodb').MongoClient,
url = 'mongodb://localhost:27017/mydb',
Q = require('q'),
db = Q.ninvoke(MongoClient, 'connect', url),
store = new MongoStore({
db: db,
collection: 'myCollection'
}),
Query = require('rql/query').Query,
query = new Query().eq('color', 'yellow').sort('-size', 'price');
// make a query using RQL
store.query(query).then(function (docs) {
// ...
});
With npm do:
npm install mongo-perstore
New BSD License. All code is developed under the terms of the Dojo Foundation CLA.
© 2014 Ben Hockey