summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/accumulator_min_max.cpp
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2015-07-01 16:47:20 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2015-07-13 17:41:39 -0400
commit1527a67262baf2d80776f86d4af0e42d53aa3eec (patch)
tree802170077582f8d30a12e548b2e6ce6578275443 /src/mongo/db/pipeline/accumulator_min_max.cpp
parent908313432e597623361df39339cee452176fd7b2 (diff)
downloadmongo-1527a67262baf2d80776f86d4af0e42d53aa3eec.tar.gz
SERVER-19105 Add macro to register Accumulators, move REGISTER_EXPRESSION to header
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_min_max.cpp')
-rw-r--r--src/mongo/db/pipeline/accumulator_min_max.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/db/pipeline/accumulator_min_max.cpp b/src/mongo/db/pipeline/accumulator_min_max.cpp
index da4f280f797..9bfbf7b380b 100644
--- a/src/mongo/db/pipeline/accumulator_min_max.cpp
+++ b/src/mongo/db/pipeline/accumulator_min_max.cpp
@@ -35,6 +35,15 @@ namespace mongo {
using boost::intrusive_ptr;
+REGISTER_ACCUMULATOR(max, AccumulatorMinMax::createMax);
+REGISTER_ACCUMULATOR(min, AccumulatorMinMax::createMin);
+
+const char* AccumulatorMinMax::getOpName() const {
+ if (_sense == 1)
+ return "$min";
+ return "$max";
+}
+
void AccumulatorMinMax::processInternal(const Value& input, bool merging) {
// nullish values should have no impact on result
if (!input.nullish()) {
@@ -67,10 +76,4 @@ intrusive_ptr<Accumulator> AccumulatorMinMax::createMin() {
intrusive_ptr<Accumulator> AccumulatorMinMax::createMax() {
return new AccumulatorMinMax(Sense::MAX);
}
-
-const char* AccumulatorMinMax::getOpName() const {
- if (_sense == 1)
- return "$min";
- return "$max";
-}
}