Co-authored-by: Hana Pearlman <hana.pearlman@mongodb.com> GitOrigin-RevId: 16d3fb2b45b12e9ae77c531a6b0a87fa3ef7e5d4
20 lines
560 B
JavaScript
20 lines
560 B
JavaScript
/*
|
|
* Tests that coerceToBool is not a valid expression.
|
|
*/
|
|
|
|
const coll = db.expr_invalid;
|
|
coll.drop();
|
|
|
|
assert.commandFailedWithCode(
|
|
db.runCommand({find: coll.getName(), filter: {$expr: {$coerceToBool: {$eq: ["$_id", 15]}}}}),
|
|
168,
|
|
"Unrecognized expression '$coerceToBool'");
|
|
|
|
assert.commandFailedWithCode(db.runCommand({
|
|
aggregate: coll.getName(),
|
|
cursor: {},
|
|
pipeline: [{$project: {x: {$coerceToBool: {$eq: ["$_id", 15]}}}}]
|
|
}),
|
|
31325,
|
|
"Unknown expression $coerceToBool");
|