cn

co-nedb

Nedb made more awesome with generators

Showing:

Popularity

Downloads/wk

1

GitHub Stars

5

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

0.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

co-nedb NPM version Dependencies Status Build Status

Nedb made more awesome with generators.

Installation

$ npm install co-nedb

Setup

Call wrap() on collections to make them generator friendly:

var Datastore = require('nedb');
var wrap = require('co-nedb');

var db = new Datastore({ autoload: true }); // in-memory database
var users = wrap(db);

Example

Simple example:

yield users.remove({});

yield users.insert({ name: 'Tobi', species: 'ferret' });
yield users.insert({ name: 'Loki', species: 'ferret' });
yield users.insert({ name: 'Jane', species: 'ferret' });

var res = yield users.findOne({ name: 'Tobi' });
res.name.should.equal('Tobi');

var res = yield users.find({ species: 'ferret' });
res.should.have.length(3);

Parallel inserts:

yield users.remove({});

yield [
  users.insert({ name: 'Tobi', species: 'ferret' }),
  users.insert({ name: 'Loki', species: 'ferret' }),
  users.insert({ name: 'Jane', species: 'ferret' })
];

var res = yield users.findOne({ name: 'Tobi' });
res.name.should.equal('Tobi');

var res = yield users.find({ species: 'ferret' });
res.should.have.length(3);

License

MIT

Changelog

v2.0.0 (18 Oct 2014)

  • Bumped thunkify version from 0.0.1 to 2.1.2.
  • Removed nedb as a dependency
  • Added .npmignore

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial