summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Liu <lriuui0x0@gmail.com>2023-10-11 15:25:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-10-12 13:54:47 +0000
commitddb1e08429308c559e4d4fccfc5d7690292bbf7a (patch)
tree07adbb737dc3bd70ebbf0a7ba34e070d6b4642f4
parent508ed295612caf220eb7db8a8d0e5a6629044b02 (diff)
SERVER-82070 Return default value for $stdDevSamp with empty windowr5.0.22-rc0
(cherry picked from commit 075e35514569813fad6dfafb0554781cfd109959)
-rw-r--r--src/mongo/db/pipeline/window_function/window_function_stddev.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/window_function/window_function_stddev.h b/src/mongo/db/pipeline/window_function/window_function_stddev.h
index 5b4aa45b075..14aa1fa1260 100644
--- a/src/mongo/db/pipeline/window_function/window_function_stddev.h
+++ b/src/mongo/db/pipeline/window_function/window_function_stddev.h
@@ -63,7 +63,7 @@ public:
if (_nonfiniteValueCount > 0)
return Value(BSONNULL);
const long long adjustedCount = _isSamp ? _count - 1 : _count;
- if (adjustedCount == 0)
+ if (adjustedCount <= 0)
return getDefault();
double squaredDifferences = _m2->getValue(false).coerceToDouble();
if (squaredDifferences < 0 || (!_isSamp && _count == 1)) {