diff options
author | Blake Oler <blake.oler@10gen.com> | 2017-10-09 11:48:26 -0400 |
---|---|---|
committer | Blake Oler <blake.oler@10gen.com> | 2017-10-09 11:48:40 -0400 |
commit | 95fedb251673c87b5172269e1f8c116b5e05fb16 (patch) | |
tree | c0fbd29a89addfb6bf54d4630c76772abf6c1564 /src/mongo/db/matcher/expression_with_placeholder.cpp | |
parent | d7a30a716243db13644a16618a939df6bc1344fc (diff) | |
download | mongo-95fedb251673c87b5172269e1f8c116b5e05fb16.tar.gz |
SERVER-31029 Add support for top-level $expr within $or and $and
Diffstat (limited to 'src/mongo/db/matcher/expression_with_placeholder.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_with_placeholder.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/mongo/db/matcher/expression_with_placeholder.cpp b/src/mongo/db/matcher/expression_with_placeholder.cpp index bb878e05cfa..86287c18bf8 100644 --- a/src/mongo/db/matcher/expression_with_placeholder.cpp +++ b/src/mongo/db/matcher/expression_with_placeholder.cpp @@ -30,6 +30,8 @@ #include "mongo/db/matcher/expression_with_placeholder.h" +#include "mongo/db/matcher/expression_parser.h" + #include <regex> namespace mongo { @@ -88,16 +90,8 @@ bool ExpressionWithPlaceholder::equivalent(const ExpressionWithPlaceholder* othe const std::regex ExpressionWithPlaceholder::placeholderRegex("^[a-z][a-zA-Z0-9]*$"); // static -StatusWith<std::unique_ptr<ExpressionWithPlaceholder>> ExpressionWithPlaceholder::parse( - BSONObj rawFilter, const boost::intrusive_ptr<ExpressionContext>& expCtx) { - StatusWithMatchExpression statusWithFilter = MatchExpressionParser::parse( - rawFilter, expCtx, ExtensionsCallbackNoop(), MatchExpressionParser::kBanAllSpecialFeatures); - - if (!statusWithFilter.isOK()) { - return statusWithFilter.getStatus(); - } - auto filter = std::move(statusWithFilter.getValue()); - +StatusWith<std::unique_ptr<ExpressionWithPlaceholder>> ExpressionWithPlaceholder::make( + std::unique_ptr<MatchExpression> filter) { auto statusWithId = parseTopLevelFieldName(filter.get()); if (!statusWithId.isOK()) { return statusWithId.getStatus(); |