diff options
Diffstat (limited to 'src/mongo/db/query/canonical_query.cpp')
-rw-r--r-- | src/mongo/db/query/canonical_query.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp index 03424a838d6..e0a164bd2a2 100644 --- a/src/mongo/db/query/canonical_query.cpp +++ b/src/mongo/db/query/canonical_query.cpp @@ -205,7 +205,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize( // Make the CQ we'll hopefully return. std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery()); Status initStatus = cq->init(opCtx, - nullptr, // no expression context + baseQuery.getExpCtx(), std::move(qr), baseQuery.canHaveNoopMatchNodes(), root->shallowClone(), @@ -261,6 +261,9 @@ void CanonicalQuery::setCollator(std::unique_ptr<CollatorInterface> collator) { // the object owned by '_collator'. We must associate the match expression tree with the new // value of '_collator'. _root->setCollator(_collator.get()); + + // In a similar vein, we must give the ExpressionContext the same collator. + _expCtx->setCollator(_collator.get()); } // static |