Name: mongodb-client
Owner: node_modules
Description: A nice API client for MongoDB.
Created: 2016-02-24 15:45:09.0
Updated: 2018-04-02 12:58:13.0
Pushed: 2017-01-26 04:11:04.0
Homepage: null
Size: 14
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A nice API client for MongoDB.
insertedIds
data format error on options.ordered = false
.insert()
method, please use the more clear insertMany()
and insertOne()
instead.options.forceServerObjectId
on write methods.m install mongodb-client
t co = require('co');
t MongoDB = require('mongodb-client');
t db = new MongoDB('mongodb://localhost:27017/myproject');
isten db connect error event
n('error', err => {
nsole.error(err);
ait for db connected
eady(() => {
let's read and write
(function*() {
const result = yield db.collection('user').insertMany([
{ name: 'fengmk2', type: 'JavaScript' },
{ name: 'dead-horse', type: 'JavaScript' },
{ name: 'tj', type: 'go' },
]);
console.log(result);
const docs = yield db.collection('user').find({ type: 'JavaScript' }).skip(10).toArray();
console.log(docs);
.catch(err => {
console.error(err);
console.error(err.stack);
;
TBD
TBD
TBD
TBD
TBD
TBD