miffo

0.2.3 • Public • Published

npm version

miffo

Wrapper for the mongodb native driver in node.js. Trying to stay as close as possible to the shell API.

Features

Install

$ npm install miffo

Usage

var Miffo = require('miffo'),
    url = 'mongodb://user:pwd@url:port/db',
    collections = ['users', 'items'],
    db = new Miffo(url, collections);
 
// connect
db.start(<cb>); // logs on success and throws otherwise. Pass cb to do async.
 
// wrapper API
db[collectionName].query({selectors}, {projections}, cb(err, data));
 
// Methods
db.oid() // new mongo-style ObjectID
db.oid(id) // ObjectID from string
oid.toHexString() // hex from ObjectID
db.bcrypt.hash() // hash pwd (See bcrypt for details)
db.bcrypt.compare() // compare pwds
 
// close
db.connection.close(); // the return object from mongo.connect is stored on db.connection

Test

# All tests pass. Needs auth data from settings.json for query operations.
$ npm test

Licence

MIT

Readme

Keywords

Package Sidebar

Install

npm i miffo

Weekly Downloads

1

Version

0.2.3

License

MIT

Last publish

Collaborators

  • karlpokus