diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2015-10-09 00:30:53 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2015-10-09 00:30:53 -0400 |
commit | d07615da82aabf70f9ff086eeed2571c49680aaa (patch) | |
tree | 0791501f53e29aa517e8b8663457b0eb3cad0be3 | |
parent | b3a6def7b9b41e29456b0c6c906fa4b84fd411df (diff) | |
download | mongo-d07615da82aabf70f9ff086eeed2571c49680aaa.tar.gz |
Revert "SERVER-20810 better error text when find, getMore, or killCursors commands issued by DBQuery fail"
This reverts commit 1b7f8319e1115bdaca3ad48c986846065db13569.
-rw-r--r-- | src/mongo/shell/query.js | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js index cdee5912385..ff238002335 100644 --- a/src/mongo/shell/query.js +++ b/src/mongo/shell/query.js @@ -654,10 +654,7 @@ DBQuery.Option = { }; function DBCommandCursor(mongo, cmdResult, batchSize) { - if (cmdResult.ok != 1) { - throw Error(tojson(cmdResult)); - } - + assert.commandWorked(cmdResult) this._batch = cmdResult.cursor.firstBatch.reverse(); // modifies input to allow popping if (mongo.useReadCommands()) { @@ -690,9 +687,7 @@ DBCommandCursor.prototype.close = function() { cursors: [ this._cursorid ], }; var cmdRes = this._db.runCommand(killCursorCmd); - if (cmdRes.ok != 1) { - throw Error("killCursors command failed: " + tojson(cmdRes)); - } + assert.commandWorked(cmdRes); this._cursorHandle.zeroCursorId(); this._cursorid = NumberLong(0); @@ -718,9 +713,7 @@ DBCommandCursor.prototype._runGetMoreCommand = function() { // Deliver the getMore command, and check for errors in the response. var cmdRes = this._db.runCommand(getMoreCmd); - if (cmdRes.ok != 1) { - throw Error("getMore command failed: " + tojson(cmdRes)); - } + assert.commandWorked(cmdRes); if (this._ns !== cmdRes.cursor.ns) { throw Error("unexpected collection in getMore response: " + |