summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_with_placeholder.cpp
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@10gen.com>2017-10-09 11:48:26 -0400
committerBlake Oler <blake.oler@10gen.com>2017-10-09 11:48:40 -0400
commit95fedb251673c87b5172269e1f8c116b5e05fb16 (patch)
treec0fbd29a89addfb6bf54d4630c76772abf6c1564 /src/mongo/db/matcher/expression_with_placeholder.cpp
parentd7a30a716243db13644a16618a939df6bc1344fc (diff)
downloadmongo-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.cpp14
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();