summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/projection_executor_test.cpp
diff options
context:
space:
mode:
authorAnton Korshunov <anton.korshunov@mongodb.com>2019-10-22 17:25:58 +0000
committerevergreen <evergreen@mongodb.com>2019-10-22 17:25:58 +0000
commitc76b92dd517a2eb770e4014ca2503b511f3c3e5f (patch)
tree9c2dc43e196bd901840b9cae9ca12fdad3a9c1db /src/mongo/db/exec/projection_executor_test.cpp
parent48706d5d2779e16e4f4183bc0fd6343510cb17e0 (diff)
downloadmongo-c76b92dd517a2eb770e4014ca2503b511f3c3e5f.tar.gz
SERVER-44065 Call optimize() on ParsedAggregationProjection when building projection executor from AST
Diffstat (limited to 'src/mongo/db/exec/projection_executor_test.cpp')
-rw-r--r--src/mongo/db/exec/projection_executor_test.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/exec/projection_executor_test.cpp b/src/mongo/db/exec/projection_executor_test.cpp
index 7d3b7410205..a1ac7467510 100644
--- a/src/mongo/db/exec/projection_executor_test.cpp
+++ b/src/mongo/db/exec/projection_executor_test.cpp
@@ -176,4 +176,11 @@ TEST_F(ProjectionExecutorTest, CanProjectFindSliceAndPositional) {
Document{fromjson("{a: {b: [2,3]}, c: [6]}")},
executor->applyTransformation(Document{fromjson("{a: {b: [1,2,3,4]}, c: [5,6,7]}")}));
}
+
+TEST_F(ProjectionExecutorTest, ExecutorOptimizesExpression) {
+ auto proj = parseWithDefaultPolicies(fromjson("{a: 1, b: {$add: [1, 2]}}"));
+ auto executor = buildProjectionExecutor(getExpCtx(), &proj, {});
+ ASSERT_DOCUMENT_EQ(Document{fromjson("{_id: true, a: true, b: {$const: 3}}")},
+ executor->serializeTransformation(boost::none));
+}
} // namespace mongo::projection_executor