diff options
Diffstat (limited to 'src/mongo/shell/query.js')
-rw-r--r-- | src/mongo/shell/query.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js index 26f6ea4d43d..250a7013e73 100644 --- a/src/mongo/shell/query.js +++ b/src/mongo/shell/query.js @@ -648,8 +648,13 @@ function DBCommandCursor(mongo, cmdResult, batchSize) { this._ns = cmdResult.cursor.ns; this._db = mongo.getDB(this._ns.substr(0, this._ns.indexOf("."))); this._collName = this._ns.substr(this._ns.indexOf(".") + 1); - } - else { + + if (cmdResult.cursor.id) { + // Note that setting this._cursorid to 0 should be accompanied by + // this._cursorHandle.zeroCursorId(). + this._cursorHandle = mongo.cursorHandleFromId(cmdResult.cursor.id); + } + } else { this._cursor = mongo.cursorFromId(cmdResult.cursor.ns, cmdResult.cursor.id, batchSize); } } @@ -683,6 +688,7 @@ DBCommandCursor.prototype._runGetMoreCommand = function() { } if (!cmdRes.cursor.id.compare(NumberLong("0"))) { + this._cursorHandle.zeroCursorId(); this._cursorid = NumberLong("0"); } else if (this._cursorid.compare(cmdRes.cursor.id)) { |