summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_bucket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/document_source_bucket.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_bucket.cpp39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/mongo/db/pipeline/document_source_bucket.cpp b/src/mongo/db/pipeline/document_source_bucket.cpp
index e7efd9b202e..3245d21b742 100644
--- a/src/mongo/db/pipeline/document_source_bucket.cpp
+++ b/src/mongo/db/pipeline/document_source_bucket.cpp
@@ -37,8 +37,8 @@
namespace mongo {
using boost::intrusive_ptr;
-using std::vector;
using std::list;
+using std::vector;
REGISTER_MULTI_STAGE_ALIAS(bucket,
LiteParsedDocumentSourceDefault::parse,
@@ -58,8 +58,7 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
BSONElement elem, const intrusive_ptr<ExpressionContext>& pExpCtx) {
uassert(40201,
str::stream() << "Argument to $bucket stage must be an object, but found type: "
- << typeName(elem.type())
- << ".",
+ << typeName(elem.type()) << ".",
elem.type() == BSONType::Object);
const BSONObj bucketObj = elem.embeddedObject();
@@ -86,15 +85,13 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
uassert(40202,
str::stream() << "The $bucket 'groupBy' field must be defined as a $-prefixed "
"path or an expression, but found: "
- << groupByField.toString(false, false)
- << ".",
+ << groupByField.toString(false, false) << ".",
groupByIsExpressionInObject || groupByIsPrefixedPath);
} else if ("boundaries" == argName) {
uassert(
40200,
str::stream() << "The $bucket 'boundaries' field must be an array, but found type: "
- << typeName(argument.type())
- << ".",
+ << typeName(argument.type()) << ".",
argument.type() == BSONType::Array);
for (auto&& boundaryElem : argument.embeddedObject()) {
@@ -102,8 +99,7 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
uassert(40191,
str::stream() << "The $bucket 'boundaries' field must be an array of "
"constant values, but found value: "
- << boundaryElem.toString(false, false)
- << ".",
+ << boundaryElem.toString(false, false) << ".",
exprConst);
boundaryValues.push_back(exprConst->getValue());
}
@@ -111,8 +107,7 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
uassert(40192,
str::stream()
<< "The $bucket 'boundaries' field must have at least 2 values, but found "
- << boundaryValues.size()
- << " value(s).",
+ << boundaryValues.size() << " value(s).",
boundaryValues.size() >= 2);
// Make sure that the boundaries are unique, sorted in ascending order, and have the
@@ -126,22 +121,14 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
uassert(40193,
str::stream() << "All values in the the 'boundaries' option to $bucket "
"must have the same type. Found conflicting types "
- << typeName(lower.getType())
- << " and "
- << typeName(upper.getType())
- << ".",
+ << typeName(lower.getType()) << " and "
+ << typeName(upper.getType()) << ".",
lowerCanonicalType == upperCanonicalType);
uassert(40194,
str::stream()
<< "The 'boundaries' option to $bucket must be sorted, but elements "
- << i - 1
- << " and "
- << i
- << " are not in ascending order ("
- << lower.toString()
- << " is not less than "
- << upper.toString()
- << ").",
+ << i - 1 << " and " << i << " are not in ascending order ("
+ << lower.toString() << " is not less than " << upper.toString() << ").",
pExpCtx->getValueComparator().evaluate(lower < upper));
}
} else if ("default" == argName) {
@@ -151,8 +138,7 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
uassert(40195,
str::stream()
<< "The $bucket 'default' field must be a constant expression, but found: "
- << argument.toString(false, false)
- << ".",
+ << argument.toString(false, false) << ".",
exprConst);
defaultValue = exprConst->getValue();
@@ -162,8 +148,7 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
uassert(
40196,
str::stream() << "The $bucket 'output' field must be an object, but found type: "
- << typeName(argument.type())
- << ".",
+ << typeName(argument.type()) << ".",
argument.type() == BSONType::Object);
for (auto&& outputElem : argument.embeddedObject()) {