summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/accumulator_multi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_multi.cpp')
-rw-r--r--src/mongo/db/pipeline/accumulator_multi.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/accumulator_multi.cpp b/src/mongo/db/pipeline/accumulator_multi.cpp
index afba2cb89b1..8affcdefb2c 100644
--- a/src/mongo/db/pipeline/accumulator_multi.cpp
+++ b/src/mongo/db/pipeline/accumulator_multi.cpp
@@ -365,6 +365,9 @@ void AccumulatorFirstLastN::_processValue(const Value& val) {
_memUsageBytes -= _deque.front().getApproximateSize();
_deque.pop_front();
} else {
+ // If our deque has 'n' elements and this is $firstN, we don't need to call process
+ // anymore.
+ _needsInput = false;
return;
}
}