diff options
author | David Storch <david.storch@10gen.com> | 2017-08-01 15:40:36 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2017-08-02 16:54:56 -0400 |
commit | 0334cb2bf602ec0123594b59504b9b3e0a099899 (patch) | |
tree | 432c8463e9e7273ec2f11978c5dcbc47e363ba84 /src/mongo/db/matcher/expression_leaf.cpp | |
parent | f38554ab9fd611bb798812e4eb1fa7e3d3bbb7e3 (diff) | |
download | mongo-0334cb2bf602ec0123594b59504b9b3e0a099899.tar.gz |
SERVER-30245 Make ArrayMatchingMatchExpression inherit from PathMatchExpression.
Diffstat (limited to 'src/mongo/db/matcher/expression_leaf.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_leaf.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp index 482ca061bc8..a07c8ada9c5 100644 --- a/src/mongo/db/matcher/expression_leaf.cpp +++ b/src/mongo/db/matcher/expression_leaf.cpp @@ -89,7 +89,8 @@ Status ComparisonMatchExpression::init(StringData path, const BSONElement& rhs) } -bool ComparisonMatchExpression::matchesSingleElement(const BSONElement& e) const { +bool ComparisonMatchExpression::matchesSingleElement(const BSONElement& e, + MatchDetails* details) const { if (e.canonicalType() != _rhs.canonicalType()) { // some special cases @@ -268,7 +269,7 @@ Status RegexMatchExpression::init(StringData path, StringData regex, StringData return setPath(path); } -bool RegexMatchExpression::matchesSingleElement(const BSONElement& e) const { +bool RegexMatchExpression::matchesSingleElement(const BSONElement& e, MatchDetails* details) const { switch (e.type()) { case String: case Symbol: { @@ -326,7 +327,7 @@ Status ModMatchExpression::init(StringData path, int divisor, int remainder) { return setPath(path); } -bool ModMatchExpression::matchesSingleElement(const BSONElement& e) const { +bool ModMatchExpression::matchesSingleElement(const BSONElement& e, MatchDetails* details) const { if (!e.isNumber()) return false; return e.numberLong() % _divisor == _remainder; @@ -363,7 +364,8 @@ Status ExistsMatchExpression::init(StringData path) { return setPath(path); } -bool ExistsMatchExpression::matchesSingleElement(const BSONElement& e) const { +bool ExistsMatchExpression::matchesSingleElement(const BSONElement& e, + MatchDetails* details) const { return !e.eoo(); } @@ -423,7 +425,7 @@ Status TypeMatchExpression::init(StringData path, Type type) { return setPath(path); } -bool TypeMatchExpression::matchesSingleElement(const BSONElement& e) const { +bool TypeMatchExpression::matchesSingleElement(const BSONElement& e, MatchDetails* details) const { if (_type.allNumbers) { return e.isNumber(); } @@ -499,7 +501,7 @@ std::unique_ptr<MatchExpression> InMatchExpression::shallowClone() const { return std::move(next); } -bool InMatchExpression::matchesSingleElement(const BSONElement& e) const { +bool InMatchExpression::matchesSingleElement(const BSONElement& e, MatchDetails* details) const { if (_hasNull && e.eoo()) { return true; } @@ -507,7 +509,7 @@ bool InMatchExpression::matchesSingleElement(const BSONElement& e) const { return true; } for (auto&& regex : _regexes) { - if (regex->matchesSingleElement(e)) { + if (regex->matchesSingleElement(e, details)) { return true; } } @@ -736,7 +738,8 @@ bool BitTestMatchExpression::performBitTest(const char* eBinary, uint32_t eBinar return mt == BITS_ALL_SET || mt == BITS_ALL_CLEAR; } -bool BitTestMatchExpression::matchesSingleElement(const BSONElement& e) const { +bool BitTestMatchExpression::matchesSingleElement(const BSONElement& e, + MatchDetails* details) const { // Validate 'e' is a number or a BinData. if (!e.isNumber() && e.type() != BSONType::BinData) { return false; |