diff options
Diffstat (limited to 'jstests/noPassthroughWithMongod/default_read_pref.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/default_read_pref.js | 95 |
1 files changed, 47 insertions, 48 deletions
diff --git a/jstests/noPassthroughWithMongod/default_read_pref.js b/jstests/noPassthroughWithMongod/default_read_pref.js index e5daba20d8a..12e8962a0a7 100644 --- a/jstests/noPassthroughWithMongod/default_read_pref.js +++ b/jstests/noPassthroughWithMongod/default_read_pref.js @@ -2,55 +2,54 @@ // on read commands run with an 'unset' read preference. (function() { - "use strict"; +"use strict"; - var mongo = db.getMongo(); - try { - var commandsRan = []; - db._mongo = { - getSlaveOk: function() { - return false; - }, - getReadPrefMode: function() { - return mongo.getReadPrefMode(); - }, - getReadPref: function() { - return mongo.getReadPref(); - }, - runCommand: function(db, cmd, opts) { - commandsRan.push({db: db, cmd: cmd, opts: opts}); - return {ok: 1}; - }, - getMinWireVersion: function() { - return mongo.getMinWireVersion(); - }, - getMaxWireVersion: function() { - return mongo.getMaxWireVersion(); - }, - isReplicaSetMember: function() { - return mongo.isReplicaSetMember(); - }, - isMongos: function() { - return mongo.isMongos(); - }, - isCausalConsistency: function() { - return false; - }, - getClusterTime: function() { - return null; - }, - }; - db._session = new _DummyDriverSession(db._mongo); +var mongo = db.getMongo(); +try { + var commandsRan = []; + db._mongo = { + getSlaveOk: function() { + return false; + }, + getReadPrefMode: function() { + return mongo.getReadPrefMode(); + }, + getReadPref: function() { + return mongo.getReadPref(); + }, + runCommand: function(db, cmd, opts) { + commandsRan.push({db: db, cmd: cmd, opts: opts}); + return {ok: 1}; + }, + getMinWireVersion: function() { + return mongo.getMinWireVersion(); + }, + getMaxWireVersion: function() { + return mongo.getMaxWireVersion(); + }, + isReplicaSetMember: function() { + return mongo.isReplicaSetMember(); + }, + isMongos: function() { + return mongo.isMongos(); + }, + isCausalConsistency: function() { + return false; + }, + getClusterTime: function() { + return null; + }, + }; + db._session = new _DummyDriverSession(db._mongo); - db.runReadCommand({ping: 1}); - assert.eq(commandsRan.length, 1); - assert.docEq(commandsRan[0].cmd, {ping: 1}, "The command should not have been wrapped."); - assert.eq( - commandsRan[0].opts & DBQuery.Option.slaveOk, 0, "The slaveOk bit should not be set."); - - } finally { - db._mongo = mongo; - db._session = new _DummyDriverSession(mongo); - } + db.runReadCommand({ping: 1}); + assert.eq(commandsRan.length, 1); + assert.docEq(commandsRan[0].cmd, {ping: 1}, "The command should not have been wrapped."); + assert.eq( + commandsRan[0].opts & DBQuery.Option.slaveOk, 0, "The slaveOk bit should not be set."); +} finally { + db._mongo = mongo; + db._session = new _DummyDriverSession(mongo); +} })(); |