diff options
Diffstat (limited to 'src/mongo/db/query/hint_parser_test.cpp')
-rw-r--r-- | src/mongo/db/query/hint_parser_test.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/query/hint_parser_test.cpp b/src/mongo/db/query/hint_parser_test.cpp index 8441eb913f1..2760a2226e8 100644 --- a/src/mongo/db/query/hint_parser_test.cpp +++ b/src/mongo/db/query/hint_parser_test.cpp @@ -58,6 +58,13 @@ TEST(CommandParsers, BadHintType) { parseHint(hint.firstElement()), AssertionException, ErrorCodes::FailedToParse); } +TEST(AggregationRequestTest, ShouldRejectHintAsArray) { + BSONObj arrayHint = BSON("hint" << BSON_ARRAY("invalid" + << "hint")); + ASSERT_THROWS_CODE( + parseHint(arrayHint.firstElement()), AssertionException, ErrorCodes::FailedToParse); +} + TEST(CommandParsers, SerializeNonEmptyHint) { auto hint = BSON("x" << 1); BSONObjBuilder bob; |