summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server25590.js
blob: b478f806029d0bb0f0e81b3308198285837863e2 (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);
})();