summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/accumulator_add_to_set.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2012-12-05 18:55:25 -0500
committerMathias Stearn <mathias@10gen.com>2012-12-10 18:54:04 -0500
commit459467c7cf47b57d8990eeb41c65b4e203e15b65 (patch)
treee1b969346a3c8f42ff60a078469b86316dd3c3c0 /src/mongo/db/pipeline/accumulator_add_to_set.cpp
parentfefb4334afe40664438668a289c6daed6813b3c3 (diff)
downloadmongo-459467c7cf47b57d8990eeb41c65b4e203e15b65.tar.gz
Normalize handling of Undefined vs EOO/missing in agg
Related tickets: SERVER-6571 replace use of Undefined as missing with EOO SERVER-6471 ignore nullish values in $min and $max accumulators SERVER-6144 divide by zero makes field disappear (this solution isn't final)
Diffstat (limited to 'src/mongo/db/pipeline/accumulator_add_to_set.cpp')
-rwxr-xr-xsrc/mongo/db/pipeline/accumulator_add_to_set.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/accumulator_add_to_set.cpp b/src/mongo/db/pipeline/accumulator_add_to_set.cpp
index 81c96ff9091..d64faf48b8f 100755
--- a/src/mongo/db/pipeline/accumulator_add_to_set.cpp
+++ b/src/mongo/db/pipeline/accumulator_add_to_set.cpp
@@ -25,11 +25,11 @@ namespace mongo {
verify(vpOperand.size() == 1);
Value prhs(vpOperand[0]->evaluate(pDocument));
- if (prhs.getType() == Undefined)
- ; /* nothing to add to the array */
- else if (!pCtx->getDoingMerge())
- set.insert(prhs);
- else {
+ if (!pCtx->getDoingMerge()) {
+ if (!prhs.missing()) {
+ set.insert(prhs);
+ }
+ } else {
/*
If we're in the router, we need to take apart the arrays we
receive and put their elements into the array we are collecting.