diff options
author | galon1 <gil.alon@mongodb.com> | 2022-09-20 20:57:33 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-20 22:51:06 +0000 |
commit | 4f0c417801b6aa0e478675220975d6dc92d45233 (patch) | |
tree | 40f19613f920c9e817996ed024265213379ddc90 /src/mongo/s/query/cluster_aggregate.cpp | |
parent | 631a1b711803941cdab5d2b11d544eae5e9ed63a (diff) | |
download | mongo-4f0c417801b6aa0e478675220975d6dc92d45233.tar.gz |
SERVER-63811 Add check to allow documents stage to run without a database existing
Diffstat (limited to 'src/mongo/s/query/cluster_aggregate.cpp')
-rw-r--r-- | src/mongo/s/query/cluster_aggregate.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/s/query/cluster_aggregate.cpp b/src/mongo/s/query/cluster_aggregate.cpp index bc8bca89730..99dff9da625 100644 --- a/src/mongo/s/query/cluster_aggregate.cpp +++ b/src/mongo/s/query/cluster_aggregate.cpp @@ -314,6 +314,7 @@ Status ClusterAggregate::runAggregate(OperationContext* opCtx, auto hasChangeStream = liteParsedPipeline.hasChangeStream(); auto involvedNamespaces = liteParsedPipeline.getInvolvedNamespaces(); auto shouldDoFLERewrite = ::mongo::shouldDoFLERewrite(request); + auto startsWithDocuments = liteParsedPipeline.startsWithDocuments(); // If the routing table is not already taken by the higher level, fill it now. if (!cm) { @@ -343,7 +344,7 @@ Status ClusterAggregate::runAggregate(OperationContext* opCtx, if (executionNsRoutingInfoStatus.isOK()) { cm = std::move(executionNsRoutingInfoStatus.getValue()); - } else if (!(hasChangeStream && + } else if (!((hasChangeStream || startsWithDocuments) && executionNsRoutingInfoStatus == ErrorCodes::NamespaceNotFound)) { appendEmptyResultSetWithStatus( opCtx, namespaces.requestedNss, executionNsRoutingInfoStatus.getStatus(), result); @@ -407,6 +408,7 @@ Status ClusterAggregate::runAggregate(OperationContext* opCtx, cm, involvedNamespaces, hasChangeStream, + startsWithDocuments, allowedToPassthrough, request.getPassthroughToShard().has_value()); @@ -481,7 +483,8 @@ Status ClusterAggregate::runAggregate(OperationContext* opCtx, namespaces, privileges, result, - hasChangeStream); + hasChangeStream, + startsWithDocuments); } case cluster_aggregation_planner::AggregationTargeter::TargetingPolicy:: kSpecificShardOnly: { |