summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@10gen.com>2022-02-02 22:54:26 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-02 23:49:05 +0000
commit3f7f9f57be3b127a6334c584b8a1795480baf1ae (patch)
tree515cd36f91d21d51ad156904338be17efd2984e6 /src/mongo/db/query
parent3731ee31ba39a831e59bf233a562e3120497c392 (diff)
downloadmongo-3f7f9f57be3b127a6334c584b8a1795480baf1ae.tar.gz
SERVER-58437 Implement pushdown logic for $lookup
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/get_executor.cpp2
-rw-r--r--src/mongo/db/query/multi_collection.h9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index cd61dfefe7c..a08402df756 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -962,7 +962,7 @@ public:
std::pair<std::unique_ptr<sbe::PlanStage>, stage_builder::PlanStageData> buildExecutableTree(
const QuerySolution& solution) const final {
- // TODO SERVER-58437 We don't pass '_collections' to the function below because at the
+ // TODO SERVER-62677 We don't pass '_collections' to the function below because at the
// moment, no pushdown is actually happening. This should be changed once the logic for
// pushdown is implemented.
return stage_builder::buildSlotBasedExecutableTree(
diff --git a/src/mongo/db/query/multi_collection.h b/src/mongo/db/query/multi_collection.h
index 77368d13682..9b3230a2cc6 100644
--- a/src/mongo/db/query/multi_collection.h
+++ b/src/mongo/db/query/multi_collection.h
@@ -80,6 +80,15 @@ public:
return _secondaryColls;
}
+ const CollectionPtr& lookupCollection(const NamespaceString& nss) const {
+ if (_mainCollName && nss == *_mainCollName) {
+ return *_mainColl;
+ } else if (auto itr = _secondaryColls.find(nss); itr != _secondaryColls.end()) {
+ return itr->second;
+ }
+ return CollectionPtr::null;
+ }
+
void clear() {
_mainColl = &CollectionPtr::null;
_secondaryColls.clear();