0.2.3 • Published 8 years ago

miffo v0.2.3

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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

0.2.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago