diff options
author | David Storch <david.storch@10gen.com> | 2015-08-07 11:30:51 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-08-10 17:39:38 -0400 |
commit | a067d03eca22d67a1ca036ea61544cd51df1490b (patch) | |
tree | dfbb817759dab8a84f8690e97e3bb060eb67da7a /src/mongo/shell/query.js | |
parent | e263b980d8a34425f3eab33298a15eeffe8a0c29 (diff) | |
download | mongo-a067d03eca22d67a1ca036ea61544cd51df1490b.tar.gz |
SERVER-19814 add compare() method to NumberLong, and use it in shell's implementation of find and getMore commands
Diffstat (limited to 'src/mongo/shell/query.js')
-rw-r--r-- | src/mongo/shell/query.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js index a28806351c2..26f6ea4d43d 100644 --- a/src/mongo/shell/query.js +++ b/src/mongo/shell/query.js @@ -642,7 +642,7 @@ function DBCommandCursor(mongo, cmdResult, batchSize) { if (mongo.useReadCommands()) { this._useReadCommands = true; - this._cursorid = cmdResult.cursor.id.toNumber(); + this._cursorid = cmdResult.cursor.id; this._batchSize = batchSize; this._ns = cmdResult.cursor.ns; @@ -665,7 +665,7 @@ DBCommandCursor.prototype = {}; DBCommandCursor.prototype._runGetMoreCommand = function() { // Construct the getMore command. var getMoreCmd = { - getMore: NumberLong(this._cursorid.toString()), + getMore: this._cursorid, collection: this._collName }; @@ -682,11 +682,12 @@ DBCommandCursor.prototype._runGetMoreCommand = function() { this._ns + " != " + cmdRes.cursor.ns); } - if (cmdRes.cursor.id.toNumber() === 0) { - this._cursorid = 0; + if (!cmdRes.cursor.id.compare(NumberLong("0"))) { + this._cursorid = NumberLong("0"); } - else if (this._cursorid !== cmdRes.cursor.id.toNumber()) { - throw Error("unexpected cursor id: " + this._cursorid + " != " + cmdRes.cursor.id); + else if (this._cursorid.compare(cmdRes.cursor.id)) { + throw Error("unexpected cursor id: " + + this._cursorid.toString() + " != " + cmdRes.cursor.id.toString()); } // Successfully retrieved the next batch. @@ -697,7 +698,7 @@ DBCommandCursor.prototype._hasNextUsingCommands = function() { assert(this._useReadCommands); if (!this._batch.length) { - if (this._cursorid === 0) { + if (!this._cursorid.compare(NumberLong("0"))) { return false; } |