0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/aggregation/bugs/server25590.js
2018-02-15 15:23:13 -05:00

20 lines
854 B
JavaScript

// 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);
})();