summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2022-08-26 15:33:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-26 17:41:05 +0000
commit331e44c65a4806d5d619ec4424380b34b071c463 (patch)
treed03a5e5817dc05f615e0cf73c85237b7bb118b3d
parent3c96fa9dc6958539b7b8d28d818bd06335ef2268 (diff)
downloadmongo-331e44c65a4806d5d619ec4424380b34b071c463.tar.gz
SERVER-69103 Always use the classic engine on the inner side of DocumentSourceLookup or $graphLookup
-rw-r--r--src/mongo/db/pipeline/document_source_graph_lookup.cpp1
-rw-r--r--src/mongo/db/pipeline/expression_context.h2
-rw-r--r--src/mongo/db/query/sbe_utils.cpp4
3 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.cpp b/src/mongo/db/pipeline/document_source_graph_lookup.cpp
index a02c02e10fd..666d8952284 100644
--- a/src/mongo/db/pipeline/document_source_graph_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source_graph_lookup.cpp
@@ -656,6 +656,7 @@ DocumentSourceGraphLookUp::DocumentSourceGraphLookUp(
_variablesParseState(expCtx->variablesParseState.copyWith(_variables.useIdGenerator())) {
const auto& resolvedNamespace = pExpCtx->getResolvedNamespace(_from);
_fromExpCtx = pExpCtx->copyForSubPipeline(resolvedNamespace.ns, resolvedNamespace.uuid);
+ _fromExpCtx->inLookup = true;
// We append an additional BSONObj to '_fromPipeline' as a placeholder for the $match stage
// we'll eventually construct from the input document.
diff --git a/src/mongo/db/pipeline/expression_context.h b/src/mongo/db/pipeline/expression_context.h
index df650699f06..0d2d87fd361 100644
--- a/src/mongo/db/pipeline/expression_context.h
+++ b/src/mongo/db/pipeline/expression_context.h
@@ -436,7 +436,7 @@ public:
// Tracks the depth of nested aggregation sub-pipelines. Used to enforce depth limits.
long long subPipelineDepth = 0;
- // True if this 'ExpressionContext' object is for the inner side of a $lookup.
+ // True if this 'ExpressionContext' object is for the inner side of a $lookup or $graphLookup.
bool inLookup = false;
// If set, this will disallow use of features introduced in versions above the provided version.
diff --git a/src/mongo/db/query/sbe_utils.cpp b/src/mongo/db/query/sbe_utils.cpp
index 58649249841..02deffee4ae 100644
--- a/src/mongo/db/query/sbe_utils.cpp
+++ b/src/mongo/db/query/sbe_utils.cpp
@@ -64,9 +64,11 @@ bool isQuerySbeCompatible(const CollectionPtr* collection,
const bool doesNotHaveElemMatchProject = !cq->getProj() || !cq->getProj()->containsElemMatch();
+ const bool isNotInnerSideOfLookup = !(expCtx && expCtx->inLookup);
+
return allExpressionsSupported && isNotCount && doesNotContainMetadataRequirements &&
isQueryNotAgainstTimeseriesCollection && isQueryNotAgainstClusteredCollection &&
doesNotSortOnMetaOrPathWithNumericComponents && isNotOplog && doesNotRequireMatchDetails &&
- doesNotHaveElemMatchProject && isNotChangeCollection;
+ doesNotHaveElemMatchProject && isNotChangeCollection && isNotInnerSideOfLookup;
}
} // namespace mongo::sbe