diff options
-rw-r--r-- | jstests/sharding/read_pref_cmd.js | 2 | ||||
-rw-r--r-- | src/mongo/shell/query.js | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js index 11646bd8e03..48f3e11fd4d 100644 --- a/jstests/sharding/read_pref_cmd.js +++ b/jstests/sharding/read_pref_cmd.js @@ -23,7 +23,7 @@ var doTest = function(conn, hostList, isMongos) { * look for the cmd just sent. */ var cmdTest = function(cmdObj, secOk, profileQuery) { - var cmdResult = testDB.runCommand(cmdObj, { readPref: { mode: 'secondary' }}); + var cmdResult = testDB.runCommand(cmdObj); jsTest.log('cmd result: ' + tojson(cmdResult)); assert(cmdResult.ok); diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js index 3b8604c25c0..2047ba502c8 100644 --- a/src/mongo/shell/query.js +++ b/src/mongo/shell/query.js @@ -63,10 +63,14 @@ DBQuery.prototype._ensureSpecial = function() { return this; var query = this._query; + var ns = this._ns; // Set special flag if the query doc starts with $query/query -- // This is common when copied from the output of the log or query profiler - this._special = query && (query["$query"] || query["query"]) ? true : false; + // Ignore this, though, for commands. + this._special = (query && (query["$query"] || query["query"]) && + ns && !(/\.\$cmd$/.test(ns))); + if (this._special && query) { // copy the input query fields to the new (wrapped query) -- converts to correct names var wrappedQuery = {}; |