Fire up a DB that's running a 4 node MongoDB cluster with 2 shards and a replication factor of 2 (with one additional arbiter per each replicaSet shard), 3 config servers, and four mongos processes (one per node). Each of these are running MongoDB v3.2.5 with SSL configured and preferred on Ubuntu 14.04 LTS in Amazon EC2.
Next, propagate at least 30 or so records into db.buggers that look similar to this (note the nulls for all but _id, stack_trace, and type.
{
"_id": ObjectId("5729855d716af211bd3d2086"),
"stack_trace": "... 8 more",
"firmware_version": null,
"timestamp": null,
"mac_address": null,
"phone_app_version": null,
"device_type": null,
"os_version": null,
"type": "Crash"
}
Homebrew 0.9.9 (git revision 6f80b; last commit 2016-05-04)
Homebrew/homebrew-core (git revision 0332; last commit 2016-05-04)
Then, connect to your mongos shell using Mongo v3.2.6 that was installed using the homebrew version listed above on a 2012 Macbook Pro running OS10.10.5. The shell is also using the Mongo-Hacker v0.0.13 extension for better colorization, etc.
Now, run this command:
mongos> db.buggers.find({timestamp: {$type: 10}}).remove()
You should see this error:
2016-05-05T08:11:35.067-0700 E QUERY [thread1] TypeError: this._db._initExtraInfo is not a function :
DBQuery.prototype.remove@/Users/toszter/.mongorc.js:444:5
@(shell):1:1
Deeper examination reveals no check for _initExtraInfo, as you'd expect:
mongos> db.analytics.find({timestamp: {$type: 10}}).remove
function (){
for ( var k in this._query ){
if ( k == "_id" && typeof( this._query[k] ) == "undefined" )
{
throw "can't have _id set to undefined in a remove expression";
}
}
this._checkMulti();
this._db._initExtraInfo();
this._mongo.remove( this._ns , this._query , false );
this._db._getExtraInfo("Removed");
}
Take note that invoking the command with query in this manner works fine:
mongos> db.analytics.remove({timestamp: {$type: 10}})
Removed 26 record(s) in 350ms
WriteResult(
{
"nRemoved": 26
}
)