Get averages from pre-aggregated reports in mongodb
- by Chris
I've got a database with pre-aggregated metrics similar to the one outlined in this use case: http://docs.mongodb.org/manual/use-cases/pre-aggregated-reports/
I have a daily collection with a subdocument for hour and minute metrics, and a 'metadata.date' entry for midnight on the day it represents. I also have a monthly collection with a day subdocument for each day.
If I want to get an average of a metric over the past eight or so days how can I do that with the aggregation framework? Is the aggregation framework not the right tool for this since it's already pre-aggregated?