summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server25590.js
blob: 329ae808a2c282f8e66cb904451295dbdbdc0580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Test that an aggregate command where the "pipeline" field has the wrong type fails with a
// TypeMismatch error.
(function() {
    "use strict";

    const coll = db.server25590;
    coll.drop();

    assert.writeOK(coll.insert({}));

    assert.commandFailedWithCode(db.runCommand({aggregate: coll.getName(), pipeline: 1}),
                                 ErrorCodes.TypeMismatch);
    assert.commandFailedWithCode(db.runCommand({aggregate: coll.getName(), pipeline: {}}),
                                 ErrorCodes.TypeMismatch);
    assert.commandFailedWithCode(db.runCommand({aggregate: coll.getName(), pipeline: [1, 2]}),
                                 ErrorCodes.TypeMismatch);
    assert.commandFailedWithCode(db.runCommand({aggregate: coll.getName(), pipeline: [1, null]}),
                                 ErrorCodes.TypeMismatch);
})();