summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_match.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-07-01 15:35:39 -0400
committerDavid Storch <david.storch@10gen.com>2016-07-14 23:41:20 -0400
commit5e504b81ab84274db75f868cf1559cee015beddd (patch)
tree38ffd9247f3c95d47191065fa6e6c15a26c44289 /src/mongo/db/pipeline/document_source_match.cpp
parent751f67f4a6ff89f7b8b2475301e1976f4f583f95 (diff)
downloadmongo-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/document_source_match.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_match.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/document_source_match.cpp b/src/mongo/db/pipeline/document_source_match.cpp
index 6067acb3597..8035c237eae 100644
--- a/src/mongo/db/pipeline/document_source_match.cpp
+++ b/src/mongo/db/pipeline/document_source_match.cpp
@@ -357,9 +357,8 @@ bool DocumentSourceMatch::isTextQuery(const BSONObj& query) {
void DocumentSourceMatch::joinMatchWith(intrusive_ptr<DocumentSourceMatch> other) {
_predicate = BSON("$and" << BSON_ARRAY(_predicate << other->getQuery()));
- // TODO SERVER-23349: Pass the appropriate CollatorInterface* instead of nullptr.
StatusWithMatchExpression status = uassertStatusOK(
- MatchExpressionParser::parse(_predicate, ExtensionsCallbackNoop(), nullptr));
+ MatchExpressionParser::parse(_predicate, ExtensionsCallbackNoop(), pExpCtx->getCollator()));
_expression = std::move(status.getValue());
}
@@ -486,14 +485,18 @@ void DocumentSourceMatch::addDependencies(DepsTracker* deps) const {
});
}
+void DocumentSourceMatch::doInjectExpressionContext() {
+ _expression->setCollator(pExpCtx->getCollator());
+}
+
DocumentSourceMatch::DocumentSourceMatch(const BSONObj& query,
const intrusive_ptr<ExpressionContext>& pExpCtx)
: DocumentSource(pExpCtx), _predicate(query.getOwned()), _isTextQuery(isTextQuery(query)) {
- // TODO SERVER-23349: Pass the appropriate CollatorInterface* instead of nullptr.
StatusWithMatchExpression status = uassertStatusOK(
- MatchExpressionParser::parse(_predicate, ExtensionsCallbackNoop(), nullptr));
+ MatchExpressionParser::parse(_predicate, ExtensionsCallbackNoop(), pExpCtx->getCollator()));
_expression = std::move(status.getValue());
getDependencies(&_dependencies);
}
+
} // namespace mongo