diff options
-rw-r--r-- | jstests/gle/get_last_error.js | 4 | ||||
-rw-r--r-- | src/mongo/shell/db.js | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/jstests/gle/get_last_error.js b/jstests/gle/get_last_error.js index d3542520c27..6c8a7a0bba1 100644 --- a/jstests/gle/get_last_error.js +++ b/jstests/gle/get_last_error.js @@ -62,7 +62,9 @@ assert.eq(gle.wtime, null); assert.gte(gle.waited, 5); assert.eq(gle.wtimeout, true); -gle = mdb.getLastErrorObj("majority", 50); +// Wait with { j: false }. { w: "majority" } waits for journaling by default, +// so we override the behavior to make it the same as the previous getLastError command. +gle = mdb.getLastErrorObj("majority", 50, false); print('Trying w=majority, 50ms timeout.'); printjson(gle); assert.eq(gle.ok, 1); diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js index 7134bea4cc6..e9c17cda693 100644 --- a/src/mongo/shell/db.js +++ b/src/mongo/shell/db.js @@ -730,12 +730,14 @@ var DB; throw _getErrorWithCode(ret, "getlasterror failed: " + tojson(res)); return res.err; }; - DB.prototype.getLastErrorObj = function(w, wtimeout) { + DB.prototype.getLastErrorObj = function(w, wtimeout, j) { var cmd = {getlasterror: 1}; if (w) { cmd.w = w; if (wtimeout) cmd.wtimeout = wtimeout; + if (j != null) + cmd.j = j; } var res = this.runCommand(cmd); |