diff options
Diffstat (limited to 'src/mongo/db/matcher/expression_parser.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_parser.cpp | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp index 811c0f323ed..fac9967cf2e 100644 --- a/src/mongo/db/matcher/expression_parser.cpp +++ b/src/mongo/db/matcher/expression_parser.cpp @@ -256,8 +256,8 @@ StatusWithMatchExpression parse(const BSONObj& obj, if (!parseExpressionMatchFunction) { return {Status(ErrorCodes::BadValue, - str::stream() << "unknown top level operator: " - << e.fieldNameStringData())}; + str::stream() + << "unknown top level operator: " << e.fieldNameStringData())}; } auto parsedExpression = parseExpressionMatchFunction( @@ -570,8 +570,7 @@ StatusWith<std::vector<uint32_t>> parseBitPositionsArray(const BSONObj& theArray return Status( ErrorCodes::BadValue, str::stream() - << "bit positions cannot be represented as a 32-bit signed integer: " - << e); + << "bit positions cannot be represented as a 32-bit signed integer: " << e); } // This checks if e is integral. @@ -590,8 +589,7 @@ StatusWith<std::vector<uint32_t>> parseBitPositionsArray(const BSONObj& theArray return Status( ErrorCodes::BadValue, str::stream() - << "bit positions cannot be represented as a 32-bit signed integer: " - << e); + << "bit positions cannot be represented as a 32-bit signed integer: " << e); } } @@ -636,9 +634,9 @@ StatusWithMatchExpression parseBitTest(StringData name, BSONElement e) { auto eBinary = e.binData(eBinaryLen); bitTestMatchExpression = std::make_unique<T>(name, eBinary, eBinaryLen); } else { - return Status( - ErrorCodes::BadValue, - str::stream() << name << " takes an Array, a number, or a BinData but received: " << e); + return Status(ErrorCodes::BadValue, + str::stream() + << name << " takes an Array, a number, or a BinData but received: " << e); } return {std::move(bitTestMatchExpression)}; @@ -693,8 +691,7 @@ StatusWithMatchExpression parseInternalSchemaRootDocEq( if (elem.type() != BSONType::Object) { return {Status(ErrorCodes::TypeMismatch, str::stream() << InternalSchemaRootDocEqMatchExpression::kName - << " must be an object, found type " - << elem.type())}; + << " must be an object, found type " << elem.type())}; } auto rootDocEq = std::make_unique<InternalSchemaRootDocEqMatchExpression>(elem.embeddedObject()); @@ -751,8 +748,7 @@ StatusWith<StringData> parseNamePlaceholder(const BSONObj& containingObject, } else if (namePlaceholderElem.type() != BSONType::String) { return {ErrorCodes::TypeMismatch, str::stream() << expressionName << " requires '" << namePlaceholderFieldName - << "' to be a string, not " - << namePlaceholderElem.type()}; + << "' to be a string, not " << namePlaceholderElem.type()}; } return {namePlaceholderElem.valueStringData()}; } @@ -804,12 +800,9 @@ StatusWith<std::unique_ptr<ExpressionWithPlaceholder>> parseExprWithPlaceholder( if (placeholder && (*placeholder != expectedPlaceholder)) { return {ErrorCodes::FailedToParse, str::stream() << expressionName << " expected a name placeholder of " - << expectedPlaceholder - << ", but '" + << expectedPlaceholder << ", but '" << exprWithPlaceholderElem.fieldNameStringData() - << "' has a mismatching placeholder '" - << *placeholder - << "'"}; + << "' has a mismatching placeholder '" << *placeholder << "'"}; } return result; } @@ -1249,8 +1242,7 @@ StatusWithMatchExpression parseInternalSchemaFixedArityArgument( if (static_cast<size_t>(inputObj.nFields()) != arity) { return {ErrorCodes::FailedToParse, str::stream() << elem.fieldNameStringData() << " requires exactly " << arity - << " MatchExpressions, but got " - << inputObj.nFields()}; + << " MatchExpressions, but got " << inputObj.nFields()}; } // Fill out 'expressions' with all of the parsed subexpressions contained in the array, @@ -1321,17 +1313,16 @@ StatusWithMatchExpression parseInternalSchemaBinDataSubType(StringData name, BSO auto valueAsInt = e.parseIntegerElementToInt(); if (!valueAsInt.isOK()) { return Status(ErrorCodes::FailedToParse, - str::stream() << "Invalid numerical BinData subtype value for " - << InternalSchemaBinDataSubTypeExpression::kName - << ": " - << e.number()); + str::stream() + << "Invalid numerical BinData subtype value for " + << InternalSchemaBinDataSubTypeExpression::kName << ": " << e.number()); } if (!isValidBinDataType(valueAsInt.getValue())) { return Status(ErrorCodes::FailedToParse, - str::stream() << InternalSchemaBinDataSubTypeExpression::kName - << " value must represent BinData subtype: " - << valueAsInt.getValue()); + str::stream() + << InternalSchemaBinDataSubTypeExpression::kName + << " value must represent BinData subtype: " << valueAsInt.getValue()); } return {std::make_unique<InternalSchemaBinDataSubTypeExpression>( |