summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/canonical_query.cpp
diff options
context:
space:
mode:
authorAndrii Dobroshynski <andrii.dobroshynski@mongodb.com>2021-08-17 15:47:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-17 17:04:21 +0000
commit26bcd0f788184402ecefdc1221faf13a1f9b6e47 (patch)
treeb02aea576ca6073006adab7dcaee6d0e8a4b7a23 /src/mongo/db/query/canonical_query.cpp
parent9f329ae9bb1c2f3e9e4eb0b0114c3eb6a3627d52 (diff)
downloadmongo-26bcd0f788184402ecefdc1221faf13a1f9b6e47.tar.gz
SERVER-57749 Optimize a projection expression prior to planning for 'find'
Diffstat (limited to 'src/mongo/db/query/canonical_query.cpp')
-rw-r--r--src/mongo/db/query/canonical_query.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp
index 2cfac7c0643..90e4ae71d43 100644
--- a/src/mongo/db/query/canonical_query.cpp
+++ b/src/mongo/db/query/canonical_query.cpp
@@ -256,11 +256,12 @@ Status CanonicalQuery::init(OperationContext* opCtx,
// Validate the projection if there is one.
if (!_findCommand->getProjection().isEmpty()) {
try {
- _proj.emplace(projection_ast::parse(expCtx,
- _findCommand->getProjection(),
- _root.get(),
- _findCommand->getFilter(),
- projectionPolicies));
+ _proj.emplace(projection_ast::parseAndAnalyze(expCtx,
+ _findCommand->getProjection(),
+ _root.get(),
+ _findCommand->getFilter(),
+ projectionPolicies,
+ true /* Should optimize? */));
// Fail if any of the projection's dependencies are unavailable.
DepsTracker{unavailableMetadata}.requestMetadata(_proj->metadataDeps());