mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-24882 Reject expressions in aggregation's exclusion projection.
This commit is contained in:
parent
aca39983fa
commit
8757e22c07
@ -184,6 +184,7 @@ private:
|
||||
"add computed fields during an exclusion projection: "
|
||||
<< _rawObj.toString(),
|
||||
!_parsedType || _parsedType == ProjectionType::kInclusion);
|
||||
_parsedType = ProjectionType::kInclusion;
|
||||
ensurePathDoesNotConflictOrThrow(prefix.fullPath());
|
||||
continue;
|
||||
}
|
||||
|
@ -186,13 +186,25 @@ TEST(ParsedAggregationProjectionType, ShouldRejectMixOfExclusionAndComputedField
|
||||
ParsedAggregationProjection::create(BSON("a" << false << "b" << wrapInLiteral(1))),
|
||||
UserException);
|
||||
|
||||
ASSERT_THROWS(
|
||||
ParsedAggregationProjection::create(BSON("a" << wrapInLiteral(1) << "b" << false)),
|
||||
UserException);
|
||||
|
||||
ASSERT_THROWS(
|
||||
ParsedAggregationProjection::create(BSON("a.b" << false << "a.c" << wrapInLiteral(1))),
|
||||
UserException);
|
||||
|
||||
ASSERT_THROWS(
|
||||
ParsedAggregationProjection::create(BSON("a.b" << wrapInLiteral(1) << "a.c" << false)),
|
||||
UserException);
|
||||
|
||||
ASSERT_THROWS(ParsedAggregationProjection::create(
|
||||
BSON("a" << BSON("b" << false << "c" << wrapInLiteral(1)))),
|
||||
UserException);
|
||||
|
||||
ASSERT_THROWS(ParsedAggregationProjection::create(
|
||||
BSON("a" << BSON("b" << wrapInLiteral(1) << "c" << false))),
|
||||
UserException);
|
||||
}
|
||||
|
||||
TEST(ParsedAggregationProjectionErrors, ShouldRejectDottedFieldInSubDocument) {
|
||||
|
Loading…
Reference in New Issue
Block a user