summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
authorEric Cox <eric.cox@mongodb.com>2020-05-06 15:26:02 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-01 20:27:40 +0000
commitcc318e18f225ccaae25b0e0c4c87d8ea91b59ba8 (patch)
treefd41fe5f08d3dc237dcadc762608b06e2775c032 /src/mongo/db/query
parent8bf94a6b123c4a8d60f7b7fd8fd860976a726fbf (diff)
downloadmongo-cc318e18f225ccaae25b0e0c4c87d8ea91b59ba8.tar.gz
SERVER-47740 Plumbing for construction of a full ExpressionContext in the sharded case
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/canonical_query.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp
index d8b34b3b9e1..38efced1c0c 100644
--- a/src/mongo/db/query/canonical_query.cpp
+++ b/src/mongo/db/query/canonical_query.cpp
@@ -98,10 +98,16 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
// Make MatchExpression.
boost::intrusive_ptr<ExpressionContext> newExpCtx;
if (!expCtx.get()) {
- newExpCtx = make_intrusive<ExpressionContext>(
- opCtx, std::move(collator), qr->nss(), qr->getRuntimeConstants());
+ newExpCtx = make_intrusive<ExpressionContext>(opCtx,
+ std::move(collator),
+ qr->nss(),
+ qr->getRuntimeConstants(),
+ qr->getLetParameters());
} else {
newExpCtx = expCtx;
+ // A collator can enter through both the QueryRequest and ExpressionContext arguments.
+ // This invariant ensures that both collators are the same because downstream we
+ // pull the collator from only one of the ExpressionContext carrier.
invariant(CollatorInterface::collatorsMatch(collator.get(), expCtx->getCollator()));
}