diff options
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_last.cpp')
-rw-r--r-- | src/mongo/db/pipeline/accumulator_last.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mongo/db/pipeline/accumulator_last.cpp b/src/mongo/db/pipeline/accumulator_last.cpp index ea65094d04b..c6fbe859719 100644 --- a/src/mongo/db/pipeline/accumulator_last.cpp +++ b/src/mongo/db/pipeline/accumulator_last.cpp @@ -21,19 +21,17 @@ namespace mongo { - Value AccumulatorLast::evaluate(const Document& pDocument) const { - verify(vpOperand.size() == 1); - + void AccumulatorLast::processInternal(const Value& input) { /* always remember the last value seen */ - pValue = vpOperand[0]->evaluate(pDocument); - - return pValue; + _last = input; } - AccumulatorLast::AccumulatorLast(): - AccumulatorSingleValue() { + Value AccumulatorLast::getValue() const { + return _last; } + AccumulatorLast::AccumulatorLast() {} + intrusive_ptr<Accumulator> AccumulatorLast::create( const intrusive_ptr<ExpressionContext> &pCtx) { intrusive_ptr<AccumulatorLast> pAccumulator( |