diff options
Diffstat (limited to 'src/mongo/db/pipeline/document_source_unwind_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_unwind_test.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/mongo/db/pipeline/document_source_unwind_test.cpp b/src/mongo/db/pipeline/document_source_unwind_test.cpp index 9eed7c7446b..e55a58a1c3b 100644 --- a/src/mongo/db/pipeline/document_source_unwind_test.cpp +++ b/src/mongo/db/pipeline/document_source_unwind_test.cpp @@ -163,8 +163,7 @@ private: void createUnwind(bool preserveNullAndEmptyArrays, bool includeArrayIndex) { auto specObj = DOC("$unwind" << DOC("path" << unwindFieldPath() << "preserveNullAndEmptyArrays" - << preserveNullAndEmptyArrays - << "includeArrayIndex" + << preserveNullAndEmptyArrays << "includeArrayIndex" << (includeArrayIndex ? Value(indexPath()) : Value()))); _unwind = static_cast<DocumentSourceUnwind*>( DocumentSourceUnwind::createFromBson(specObj.toBson().firstElement(), ctx()).get()); @@ -474,8 +473,9 @@ class SeveralMoreDocuments : public CheckResultsBase { deque<DocumentSource::GetNextResult> inputData() override { return {DOC("_id" << 0 << "a" << BSONNULL), DOC("_id" << 1), - DOC("_id" << 2 << "a" << DOC_ARRAY("a"_sd - << "b"_sd)), + DOC("_id" << 2 << "a" + << DOC_ARRAY("a"_sd + << "b"_sd)), DOC("_id" << 3), DOC("_id" << 4 << "a" << DOC_ARRAY(1 << 2 << 3)), DOC("_id" << 5 << "a" << DOC_ARRAY(4 << 5 << 6)), @@ -763,8 +763,7 @@ TEST_F(UnwindStageTest, ShouldRejectNonDollarPrefixedPath) { TEST_F(UnwindStageTest, ShouldRejectNonBoolPreserveNullAndEmptyArrays) { ASSERT_THROWS_CODE(createUnwind(BSON("$unwind" << BSON("path" << "$x" - << "preserveNullAndEmptyArrays" - << 2))), + << "preserveNullAndEmptyArrays" << 2))), AssertionException, 28809); } @@ -772,8 +771,7 @@ TEST_F(UnwindStageTest, ShouldRejectNonBoolPreserveNullAndEmptyArrays) { TEST_F(UnwindStageTest, ShouldRejectNonStringIncludeArrayIndex) { ASSERT_THROWS_CODE(createUnwind(BSON("$unwind" << BSON("path" << "$x" - << "includeArrayIndex" - << 2))), + << "includeArrayIndex" << 2))), AssertionException, 28810); } @@ -805,16 +803,13 @@ TEST_F(UnwindStageTest, ShoudlRejectDollarPrefixedIncludeArrayIndex) { TEST_F(UnwindStageTest, ShouldRejectUnrecognizedOption) { ASSERT_THROWS_CODE(createUnwind(BSON("$unwind" << BSON("path" << "$x" - << "preserveNullAndEmptyArrays" - << true - << "foo" - << 3))), + << "preserveNullAndEmptyArrays" << true + << "foo" << 3))), AssertionException, 28811); ASSERT_THROWS_CODE(createUnwind(BSON("$unwind" << BSON("path" << "$x" - << "foo" - << 3))), + << "foo" << 3))), AssertionException, 28811); } |