summaryrefslogtreecommitdiff
path: root/jstests/core/validate_pseudocommand_ns.js
blob: 8faf4f802d81c1869f4e944d81b997800a7e0756 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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();
        });
    }
})();