summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/expression_context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/expression_context.cpp')
-rw-r--r--src/mongo/db/pipeline/expression_context.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mongo/db/pipeline/expression_context.cpp b/src/mongo/db/pipeline/expression_context.cpp
index 865bf08ec6c..5bccef201ae 100644
--- a/src/mongo/db/pipeline/expression_context.cpp
+++ b/src/mongo/db/pipeline/expression_context.cpp
@@ -39,27 +39,27 @@ ExpressionContext::ResolvedNamespace::ResolvedNamespace(NamespaceString ns,
std::vector<BSONObj> pipeline)
: ns(std::move(ns)), pipeline(std::move(pipeline)) {}
-ExpressionContext::ExpressionContext(OperationContext* opCtx, const AggregationRequest& request)
+ExpressionContext::ExpressionContext(OperationContext* opCtx,
+ const AggregationRequest& request,
+ std::unique_ptr<CollatorInterface> collator,
+ StringMap<ResolvedNamespace> resolvedNamespaces)
: isExplain(request.isExplain()),
inShard(request.isFromRouter()),
extSortAllowed(request.shouldAllowDiskUse()),
bypassDocumentValidation(request.shouldBypassDocumentValidation()),
ns(request.getNamespaceString()),
opCtx(opCtx),
- collation(request.getCollation()) {
- if (!collation.isEmpty()) {
- auto statusWithCollator =
- CollatorFactoryInterface::get(opCtx->getServiceContext())->makeFromBSON(collation);
- uassertStatusOK(statusWithCollator.getStatus());
- setCollator(std::move(statusWithCollator.getValue()));
- }
-}
+ collation(request.getCollation()),
+ _collator(std::move(collator)),
+ _documentComparator(_collator.get()),
+ _valueComparator(_collator.get()),
+ _resolvedNamespaces(std::move(resolvedNamespaces)) {}
void ExpressionContext::checkForInterrupt() {
// This check could be expensive, at least in relative terms, so don't check every time.
- if (--interruptCounter == 0) {
+ if (--_interruptCounter == 0) {
opCtx->checkForInterrupt();
- interruptCounter = kInterruptCheckPeriod;
+ _interruptCounter = kInterruptCheckPeriod;
}
}
@@ -90,9 +90,9 @@ intrusive_ptr<ExpressionContext> ExpressionContext::copyWith(NamespaceString ns)
expCtx->setCollator(_collator->clone());
}
- expCtx->resolvedNamespaces = resolvedNamespaces;
+ expCtx->_resolvedNamespaces = _resolvedNamespaces;
- // Note that we intentionally skip copying the value of 'interruptCounter' because 'expCtx' is
+ // Note that we intentionally skip copying the value of '_interruptCounter' because 'expCtx' is
// intended to be used for executing a separate aggregation pipeline.
return expCtx;