Details
-
Task
-
Resolution: Done
-
Minor - P4
-
None
-
None
-
None
-
Node.js
-
Empty show more show less
Description
Collection.insert documentation at http://mongodb.github.io/node-mongodb-native/api-generated/collection.html#insert states it returns null ("Returns: null"). In fact, it returns the collection. The significance is the fact that code can be chained.
var mongo = require('mongodb');
var assert = require('assert');
var server = new mongo.Server('localhost', 27017,
);
var db = new mongo.Db('dbnameGoesHere', server,
);
db.open(function(err, db) {
var collection = db.collection('collectionNameGoesHere');
var result = collection.insert({}, function(err, doc)
);
assert(result instanceof mongo.Collection);
});