[SERVER-5044] $stdDev aggregation operator for standard deviation Created: 22/Feb/12  Updated: 03/Jan/18  Resolved: 16/Jun/15

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 3.1.5

Type: New Feature Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Fixed Votes: 25
Labels: pull-request

Issue Links:
related to CSHARP-1367 $stdDev aggregation operator for stan... Closed
related to JAVA-1935 $stdDev aggregation operator for stan... Closed
is related to DRIVERS-234 Aggregation Builder Support for 3.2 Closed
Backwards Compatibility: Fully Compatible
Sprint: Quint Iteration 4, Quint Iteration 5
Linked BF Score: 0


see https://gist.github.com/1886960 for an algorithm to handle calculating standard deviation and variance across many servers.

Comment by Chris Westin [ 22/Feb/12 ]

I'm assuming this is meant to be for $group.

Comment by Mathias Stearn [ 27/Feb/12 ]


Ideally any $group op should be usable in a $project against an array field, but that is a different issue.

Comment by Justin [ 04/Apr/13 ]

I started this today. Here is the commit in github. https://github.com/base698/mongo/commit/2f9ab97ffb6f027faf4c503ba4a58e500eb6fb23

It needs tests and variance. It probably could be refactored to do average, variance and standard deviation in one motion since you have to do it incrementally.

Comment by Matt Kangas [ 08/Jul/13 ]

Closed https://github.com/mongodb/mongo/pull/409 due to inactivity

Comment by Ranjith Ramachandra [ 12/Jul/13 ]

Any idea if this will be picked up at all?

Comment by Michael Svendsen [ 27/Jul/13 ]

I opened a pull request for this today. https://github.com/mongodb/mongo/pull/464

This implements standard deviation and variance calculations using the algorithm listed in the description.

Comment by auto [ 21/Oct/13 ]


{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: Clean up AccumulatorAvg

Major change is not inheriting from AccumulatorSum

Prep for SERVER-5044 $stdDev accumulator
Branch: master

Comment by Kevin Davenport [ 16/Jan/14 ]

This is a must have.

Comment by Himanshu Jain [ 03/Feb/15 ]

Hey, It's a nice to have feature.
Any updates on this ?

Comment by Githook User [ 09/Jun/15 ]


{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-5044 Standard Deviation accumulator operators
Branch: master

Comment by Githook User [ 10/Jun/15 ]


{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-5044 Use relative error when testing sharded $stdDev operations
Branch: master

Generated at Sat Dec 15 04:16:44 UTC 2018 using Jira 7.12.1#712002-sha1:609a50578ba6bc73dbf8b05dddd7c04a04b6807c.