LocalData/localdata-api — pull request #242 by prashtx (2014-10-22 02:37:47+00:00)
Title: Use group aggregation for stats

The stats calculation is essentially a reduce job with no need for a map step. Since we're not using sharding, and since the output will be well under the 16 MB limit, we can use the `group` operation. We avoid transferring the entire data set to the server, and we avoid the map-reduce performance penalty. Compared to the previous stats implementation, we take 25% (up to possibly 50%) less time for surveys with tens of thousands of entries.