Same thing here.
If you copy/paste the example (and you correct the typo) the callback assertion throws.
var Db = require('mongodb').Db,
MongoClient = require('mongodb').MongoClient,
Server = require('mongodb').Server,
ReplSetServers = require('mongodb').ReplSetServers,
ObjectID = require('mongodb').ObjectID,
Binary = require('mongodb').Binary,
GridStore = require('mongodb').GridStore,
Grid = require('mongodb').Grid,
Code = require('mongodb').Code,
BSON = require('mongodb').pure().BSON,
assert = require('assert');
var db = new Db('test', new Server('localhost', 27017));
// Establish connection to db
db.open(function(err, db) {
// Fetch a collection to insert document into
db.collection("remove_subset_of_documents_safe", function(err, collection) {
// Insert a bunch of documents
collection.insert([{a:1}, {b:2}], {w:1}, function(err, result) {
assert.equal(null, err);
// Remove all the document
collection.remove({a:1}, {w:1}, function(err, numberOfRemovedDocs) {
assert.equal(null, err);
assert.equal(1, numberOfRemovedDocs);
db.close();
});
});
})
});