summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_bucket.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-10-03 11:17:13 -0400
committerDavid Storch <david.storch@10gen.com>2016-10-03 16:13:51 -0400
commit8758a5c7be68effbc4a1f857787bfb7b201c6389 (patch)
tree4880b453167dcada211c278dbc34ff095e31d81c /src/mongo/db/pipeline/document_source_bucket.cpp
parentb8a5742ef7623640eb6977f14e25649bad661208 (diff)
downloadmongo-8758a5c7be68effbc4a1f857787bfb7b201c6389.tar.gz
SERVER-25038 add LiteParsedPipeline
This provides a way to do pre-parse validity checks. Full parsing of the Pipeline must be done under the collection lock, when the collation is known.
Diffstat (limited to 'src/mongo/db/pipeline/document_source_bucket.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_bucket.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mongo/db/pipeline/document_source_bucket.cpp b/src/mongo/db/pipeline/document_source_bucket.cpp
index f3eebe2860c..484f4b9a62f 100644
--- a/src/mongo/db/pipeline/document_source_bucket.cpp
+++ b/src/mongo/db/pipeline/document_source_bucket.cpp
@@ -28,12 +28,16 @@
#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/lite_parsed_document_source.h"
+
namespace mongo {
using boost::intrusive_ptr;
using std::vector;
-REGISTER_MULTI_STAGE_ALIAS(bucket, DocumentSourceBucket::createFromBson);
+REGISTER_MULTI_STAGE_ALIAS(bucket,
+ LiteParsedDocumentSourceDefault::parse,
+ DocumentSourceBucket::createFromBson);
namespace {
intrusive_ptr<ExpressionConstant> getExpressionConstant(BSONElement expressionElem,
@@ -121,8 +125,6 @@ vector<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
<< typeName(upper.getType())
<< ".",
lowerCanonicalType == upperCanonicalType);
- // TODO SERVER-25038: This check must be deferred so that it respects the final
- // collator, which is not necessarily the same as the collator at parse time.
uassert(40194,
str::stream()
<< "The 'boundaries' option to $bucket must be sorted, but elements "
@@ -178,9 +180,6 @@ vector<intrusive_ptr<DocumentSource>> DocumentSourceBucket::createFromBson(
// If the default has the same canonical type as the bucket's boundaries, then make sure the
// default is less than the lowest boundary or greater than or equal to the highest
// boundary.
- //
- // TODO SERVER-25038: This check must be deferred so that it respects the final collator,
- // which is not necessarily the same as the collator at parse time.
const auto& valueCmp = pExpCtx->getValueComparator();
const bool hasValidDefault = valueCmp.evaluate(defaultValue < lowerValue) ||
valueCmp.evaluate(defaultValue >= upperValue);