Moving averages with MongoDB's aggregation framework?
If you have 50 years of temperature weather data (daily) (for example) how would you calculate moving averages, using 3-month intervals, for that time period? Can you do that with one query or would you have to have multiple queries? Example Data 01/01/2014 = 40 degrees 12/31/2013 = 38 degrees 12/30/2013 = 29 degrees 12/29/2013 = 31 degrees 12/28/2013 = 34 degrees 12/27/2013 = 36 degrees 12/26/2013 = 38 degrees ..... The agg framework now has $map and $reduce and $range built in so array processing is much more straightfoward. Below is an example of calculating moving average on a set of data