summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/window_function/partition_iterator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/window_function/partition_iterator.cpp')
-rw-r--r--src/mongo/db/pipeline/window_function/partition_iterator.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/window_function/partition_iterator.cpp b/src/mongo/db/pipeline/window_function/partition_iterator.cpp
index ea59f5c6e09..872b4eb0b8d 100644
--- a/src/mongo/db/pipeline/window_function/partition_iterator.cpp
+++ b/src/mongo/db/pipeline/window_function/partition_iterator.cpp
@@ -301,8 +301,13 @@ optional<std::pair<int, int>> PartitionIterator::getEndpointsRangeBased(
for (int i = start; (doc = (*this)[i]); ++i) {
Value v = (*_sortExpr)->evaluate(*doc, &_expCtx->variables);
if (!lessThan(v, threshold)) {
- // This is the first doc we've scanned that crossed the threshold.
- return i;
+ // This is the first doc we've scanned that crossed the threshold,
+ // so it's the first doc in the window (as long as it's the expected type).
+ if (hasExpectedType(v)) {
+ return i;
+ } else {
+ return boost::none;
+ }
}
}
// We scanned every document in the partition, and none crossed the