Files
mongo/jstests/core/validate_pseudocommand_ns.js
David Storch df2a33f997 SERVER-20067 SERVER-19572 set readMode in shell based on wire version
"compatibility" readMode now causes the shell to detect whether or not
to use find/getMore commands based on wire version. "commands" mode
forces use of the find/getMore commands, and "legacy" mode forces uses
of legacy OP_QUERY/OP_GET_MORE reads.

Also configures tests to force use of "commands" or "legacy" mode as
appropriate.
2015-09-30 13:25:15 -04:00

14 lines
601 B
JavaScript

// Test that we validate nToReturn when upconverting pseudoCommands.
(function() {
"use strict";
if (!db.getMongo().useReadCommands()) {
var inprog = db.$cmd.sys.inprog;
// nToReturn must be 1 or -1.
assert.doesNotThrow(function() { inprog.find().limit(-1).next(); });
assert.doesNotThrow(function() { inprog.find().limit(1).next(); });
assert.throws(function() { inprog.find().limit(0).next(); });
assert.throws(function() { inprog.find().limit(-2).next(); });
assert.throws(function() { inprog.find().limit(99).next(); });
}
})();