nosqlite is human readable nosql type filesystem json store
npm install nosqlite
// Default path for store
connection = new(require('nosqlite').Connection)();
// Custom path for store
connection = new(require('nosqlite').Connection)('/path/to/store');
// Default db is 'test'
db = connection.database('dummy');
// Async
db.exists(function (exists) {
if (!exists) console.log('Need to create it');
});
// Sync
if (!db.existsSync()) console.log('Need to create it');
// Async
db.create(function (err) {
if (err) throw err;
});
//Sync
db.createSync();
// Async
db.destroy(function (err) {
if (err) throw err;
});
//Sync
db.destroySync();
If obj.id
(or obj._id
) is not supplied, obj.id
is auto generated.
// Async
db.post(obj, function (err, id) {
if (err) throw err;
console.log(id);
});
// Sync
// returns id
db.postSync(obj);
// Async
db.get('bob', function(err, obj) {
if (err) throw err;
console.log(obj);
});
// Sync
db.getSync('bob');
// Async
db.put('bob', {age: 35}, function (err) {
if (err) throw err;
});
// Sync
db.putSync('bob', {age: 35});
// Async
db.delete('bob', function (err) {
if (err) throw err;
});
// Sync
db.deleteSync('bob');
// Async
db.find({hair: 'black'}, function (err, docs) {
if (err) throw err;
});
// Sync
docs = db.findSync({hair: 'black'});
// Async
db.all(function (err, docs) {
if (err) throw err;
});
// Sync
docs = db.allSync();
If you like this project, please watch this and follow me.
npm test
Here is a list of Contributors
Auto ID generation- Authentication system
- Map-Reduce (views)
- Buffer writes internally
- Concurrent writes from multi processes
I accept pull requests and guarantee a reply back within a day
MIT/X11
Report here. Guaranteed reply within a day.
Pavan Kumar Sunkara (pavan.sss1991@gmail.com)