summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthroughWithMongod/create_indexes_shell_helper.js')
-rw-r--r--jstests/noPassthroughWithMongod/create_indexes_shell_helper.js24
1 files changed, 1 insertions, 23 deletions
diff --git a/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js b/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js
index 6d9937139ae..8a36f7ee11e 100644
--- a/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js
+++ b/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js
@@ -9,11 +9,8 @@
var commandsRan = [];
var insertsRan = [];
var mockMongo = {
- forceWriteMode: function(mode) {
- this._writeMode = mode;
- },
writeMode: function() {
- return this._writeMode;
+ return "commands";
},
getSlaveOk: function() {
return true;
@@ -22,10 +19,6 @@
commandsRan.push({db: db, cmd: cmd, opts: opts});
return {ok: 1.0};
},
- insert: function(db, indexSpecs, opts) {
- insertsRan.push({db: db, indexSpecs: indexSpecs, opts: opts});
- return {ok: 1.0};
- },
getWriteConcern: function() {
return null;
},
@@ -58,8 +51,6 @@
db._mongo = mockMongo;
db._session = new _DummyDriverSession(mockMongo);
- mockMongo.forceWriteMode("commands");
-
t.createIndexes([{x: 1}]);
assert.eq(commandsRan.length, 1);
assert(commandsRan[0].cmd.hasOwnProperty("createIndexes"));
@@ -79,19 +70,6 @@
assert.eq(commandsRan.length, 1);
assert(commandsRan[0].cmd.hasOwnProperty("createIndexes"));
assert.eq(commandsRan[0].cmd["indexes"][0], {key: {a: 1}, name: "a_1"});
-
- db.getMongo().forceWriteMode("compatibility");
-
- commandsRan = [];
- assert.eq(commandsRan.length, 0);
- t.createIndex({b: 1});
- assert.eq(insertsRan.length, 1);
- assert.eq(insertsRan[0]["indexSpecs"]["ns"], "test.create_indexes_shell_helper");
- assert.eq(insertsRan[0]["indexSpecs"]["key"], {b: 1});
- assert.eq(insertsRan[0]["indexSpecs"]["name"], "b_1");
- // getLastError is called in the course of the bulk insert
- assert.eq(commandsRan.length, 1);
- assert(commandsRan[0].cmd.hasOwnProperty("getlasterror"));
} finally {
db._mongo = mongo;
db._session = new _DummyDriverSession(mongo);