mangodb-client
v2.0.0
Published
Powerful Node.js client for Mangodb
Downloads
10
Maintainers
Readme
mangodb-client
A powerful MangoDB client for Node.js
Most users just want to get started quickly without getting weighed down by features. The mangodb-client brings a whole new level of simplicity. Happy sharting!
Installation
npm install --save mangodb-client
Usage
// Node auto-discovery. Or use any config format of your own invention!
const db = require('mangodb-client')();
// Write something (guaranteed consistency)
db.put('key', 'value', error => {
if (error) {
// Not even worried
} else {
console.log('cool')
}
});
// And with Promises
db.put('key', 'value').then(() => console.log('yep'));
// Read something (predictive result, which will self-correct
// if the server sends a more accurate response).
db.get('key', (error, {key, value}) => {
if (error) {
// Still not worried
} else {
console.log(`Got ${value} at ${key}`)
}
});
// And with Promises
db.get('key').then(({key, value}) => console.log(`Got ${value} at ${key}`));