diff options
author | David Storch <david.storch@10gen.com> | 2016-02-05 16:30:44 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-02-22 09:57:09 -0500 |
commit | 148c13f77781373543063740e5ea7445c3978849 (patch) | |
tree | 9197632a67ca693078f7448a5e5c74e20e0305a3 /src/mongo/shell | |
parent | 86884b98e44f4a77f5b66970a6138874f2b98cf3 (diff) | |
download | mongo-148c13f77781373543063740e5ea7445c3978849.tar.gz |
SERVER-22440 fix shell to resolve readMode correctly on first .find() operation
(cherry picked from commit eeac75151395b523459833aaaa34d0fe2f2f7748)
Diffstat (limited to 'src/mongo/shell')
-rw-r--r-- | src/mongo/shell/mongo.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mongo/shell/mongo.js b/src/mongo/shell/mongo.js index 3dd44fee978..68bc0ac54d8 100644 --- a/src/mongo/shell/mongo.js +++ b/src/mongo/shell/mongo.js @@ -312,16 +312,14 @@ Mongo.prototype.forceReadMode = function(mode) { * and OP_GET_MORE, or "compatibility" for detecting based on wire version). */ Mongo.prototype.readMode = function() { - if (this._readMode !== "compatibility") { - if ("_readMode" in this) { - // We already have determined our read mode. Just return it. - return this._readMode; - } + // Get the readMode from the shell params if we don't have one yet. + if (typeof _readMode === "function" && !this.hasOwnProperty("_readMode")) { + this._readMode = _readMode(); + } - // Get the readMode from the shell params. - if (typeof _readMode === "function") { - this._readMode = _readMode(); - } + if (this.hasOwnProperty("_readMode") && this._readMode !== "compatibility") { + // We already have determined our read mode. Just return it. + return this._readMode; } else { // We're in compatibility mode. Determine whether the server supports the find/getMore |