summaryrefslogtreecommitdiff
path: root/jstests/core/list_indexes_invalid.js
blob: 0e9c5ffa88c726ea00682d92960a7fc10b31906d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Test for invalid values of "cursor" and "cursor.batchSize".

var coll = db.list_indexes_invalid;
coll.drop();

assert.commandWorked(coll.getDB().createCollection(coll.getName()));
assert.commandWorked(coll.ensureIndex({a: 1}, {unique: true}));

assert.throws(function() {
    getListIndexesCursor(coll, {cursor: 0});
});
assert.throws(function() {
    getListIndexesCursor(coll, {cursor: 'x'});
});
assert.throws(function() {
    getListIndexesCursor(coll, {cursor: []});
});
assert.throws(function() {
    getListIndexesCursor(coll, {cursor: {foo: 1}});
});
assert.throws(function() {
    getListIndexesCursor(coll, {cursor: {batchSize: -1}});
});
assert.throws(function() {
    getListIndexesCursor(coll, {cursor: {batchSize: 'x'}});
});
assert.throws(function() {
    getListIndexesCursor(coll, {cursor: {batchSize: {}}});
});
assert.throws(function() {
    getListIndexesCursor(coll, {cursor: {batchSize: 2, foo: 1}});
});