diff options
author | David Storch <david.storch@10gen.com> | 2016-07-01 15:35:39 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-07-14 23:41:20 -0400 |
commit | 5e504b81ab84274db75f868cf1559cee015beddd (patch) | |
tree | 38ffd9247f3c95d47191065fa6e6c15a26c44289 /src/mongo/db/pipeline/expression_context.cpp | |
parent | 751f67f4a6ff89f7b8b2475301e1976f4f583f95 (diff) | |
download | mongo-5e504b81ab84274db75f868cf1559cee015beddd.tar.gz |
SERVER-24508 DocumentComparator and ValueComparator
- Changes the Document/Value library to require comparisons
to be made in the context of a comparator object. This is
prep work for full collation support in the aggregation
system.
- Adds injectExpressionContext() to propagate the
ExpressionContext containing the comparator object to all
DocumentSource, Accumulator, and Expression instances
involved in the Pipeline.
Diffstat (limited to 'src/mongo/db/pipeline/expression_context.cpp')
-rw-r--r-- | src/mongo/db/pipeline/expression_context.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/expression_context.cpp b/src/mongo/db/pipeline/expression_context.cpp index d7c5a6708a0..5992b8aa708 100644 --- a/src/mongo/db/pipeline/expression_context.cpp +++ b/src/mongo/db/pipeline/expression_context.cpp @@ -45,7 +45,7 @@ ExpressionContext::ExpressionContext(OperationContext* opCtx, const AggregationR auto statusWithCollator = CollatorFactoryInterface::get(opCtx->getServiceContext())->makeFromBSON(collation); uassertStatusOK(statusWithCollator.getStatus()); - collator = std::move(statusWithCollator.getValue()); + setCollator(std::move(statusWithCollator.getValue())); } } @@ -56,4 +56,13 @@ void ExpressionContext::checkForInterrupt() { interruptCounter = kInterruptCheckPeriod; } } + +void ExpressionContext::setCollator(std::unique_ptr<CollatorInterface> coll) { + _collator = std::move(coll); + + // Document/Value comparisons must be aware of the collation. + _documentComparator = DocumentComparator(_collator.get()); + _valueComparator = ValueComparator(_collator.get()); +} + } // namespace mongo |