summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_densify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/document_source_densify.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_densify.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/mongo/db/pipeline/document_source_densify.cpp b/src/mongo/db/pipeline/document_source_densify.cpp
index b7899f078a2..740ef193431 100644
--- a/src/mongo/db/pipeline/document_source_densify.cpp
+++ b/src/mongo/db/pipeline/document_source_densify.cpp
@@ -335,19 +335,10 @@ DocumentSource::GetNextResult DocumentSourceInternalDensify::densifyExplicitRang
RangeStatement(_range.getStep(),
ExplicitBounds(bounds.first, bounds.second),
_range.getUnit()));
- } else if (_current < bounds.first) {
- // All the documents we saw were below the explicit range, so _current is below the range.
- // Densification starts at the first bounds, so _current is no longer relevant.
- createDocGenerator(bounds.first,
- RangeStatement(_range.getStep(),
- ExplicitBounds(bounds.first, bounds.second),
- _range.getUnit()));
-
} else if (_current->increment(_range) >= bounds.second) {
_densifyState = DensifyState::kDensifyDone;
return DocumentSource::GetNextResult::makeEOF();
} else {
- // _current is somewhere in the middle of the range.
auto lowerBound = _current->increment(_range);
createDocGenerator(lowerBound,
RangeStatement(_range.getStep(),
@@ -417,7 +408,6 @@ DocumentSource::GetNextResult DocumentSourceInternalDensify::processFirstDocForE
case ValComparedToRange::kRangeMin: {
_densifyState = DensifyState::kNeedGen;
_current = val;
- setPartitionValue(doc);
return doc;
}
case ValComparedToRange::kBelow: {
@@ -645,16 +635,17 @@ boost::intrusive_ptr<DocumentSource> DocumentSourceInternalDensify::createFromBs
return results.front();
}
-Value DocumentSourceInternalDensify::serialize(const SerializationOptions& opts) const {
+Value DocumentSourceInternalDensify::serialize(
+ boost::optional<ExplainOptions::Verbosity> explain) const {
MutableDocument spec;
- spec[kFieldFieldName] = Value(opts.serializeFieldPath(_field));
+ spec[kFieldFieldName] = Value(_field.fullPath());
std::vector<Value> serializedPartitionByFields(_partitions.size());
std::transform(_partitions.begin(),
_partitions.end(),
serializedPartitionByFields.begin(),
- [&](FieldPath field) -> Value { return Value(opts.serializeFieldPath(field)); });
+ [&](FieldPath field) -> Value { return Value(field.fullPath()); });
spec[kPartitionByFieldsFieldName] = Value(serializedPartitionByFields);
- spec[kRangeFieldName] = _range.serialize(opts);
+ spec[kRangeFieldName] = _range.serialize();
MutableDocument out;
out[getSourceName()] = Value(spec.freeze());