diff options
author | megawac <megawac@gmail.com> | 2016-02-04 19:54:51 -0500 |
---|---|---|
committer | Ramon Fernandez <ramon@mongodb.com> | 2016-03-14 16:38:31 -0400 |
commit | b11988543dbba0cf77adf1f01c558c796be9ff72 (patch) | |
tree | 5330b0f61d974247cd42d28a0e0a8f1d9037e4ac | |
parent | 25b851b56e93f3ee1c207d46d141a189a8babc1c (diff) | |
download | mongo-b11988543dbba0cf77adf1f01c558c796be9ff72.tar.gz |
SERVER-23102 Improve error message for array query properties
Signed-off-by: Ramon Fernandez <ramon@mongodb.com>
Closes #1066
-rw-r--r-- | src/mongo/db/matcher/expression_parser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp index 859458453dd..c249f28a4be 100644 --- a/src/mongo/db/matcher/expression_parser.cpp +++ b/src/mongo/db/matcher/expression_parser.cpp @@ -300,7 +300,7 @@ StatusWithMatchExpression MatchExpressionParser::_parse(const BSONObj& obj, int // TODO: optimize if block? if (mongoutils::str::equals("or", rest)) { if (e.type() != Array) - return {Status(ErrorCodes::BadValue, "$or needs an array")}; + return {Status(ErrorCodes::BadValue, "$or must be an array")}; std::unique_ptr<OrMatchExpression> temp = stdx::make_unique<OrMatchExpression>(); Status s = _parseTreeList(e.Obj(), temp.get(), level); if (!s.isOK()) @@ -308,7 +308,7 @@ StatusWithMatchExpression MatchExpressionParser::_parse(const BSONObj& obj, int root->add(temp.release()); } else if (mongoutils::str::equals("and", rest)) { if (e.type() != Array) - return {Status(ErrorCodes::BadValue, "and needs an array")}; + return {Status(ErrorCodes::BadValue, "$and must be an array")}; std::unique_ptr<AndMatchExpression> temp = stdx::make_unique<AndMatchExpression>(); Status s = _parseTreeList(e.Obj(), temp.get(), level); if (!s.isOK()) @@ -316,7 +316,7 @@ StatusWithMatchExpression MatchExpressionParser::_parse(const BSONObj& obj, int root->add(temp.release()); } else if (mongoutils::str::equals("nor", rest)) { if (e.type() != Array) - return {Status(ErrorCodes::BadValue, "and needs an array")}; + return {Status(ErrorCodes::BadValue, "$nor must be an array")}; std::unique_ptr<NorMatchExpression> temp = stdx::make_unique<NorMatchExpression>(); Status s = _parseTreeList(e.Obj(), temp.get(), level); if (!s.isOK()) |