I need to write some reports on top of the data in my couch db application. My use case is a central database monitoring the data coming in from a bunch of satellite sites, and they want to generate aggregate reports on the data by site and by date range.
My current plan is to use a view with a complex key that includes the site id and date the data came in, with the value being a dictionary of contributions the data makes to each aggregate indicator in the report. Then my reduce function can just sum up the individual keys. However, this will only generate reports with the granularity of a single day out-of-the-box, which means I will need to do further processing on the client side in order to aggregate the counts over the entire range specified. My question is -- is there any way to do this in one view via couchdb? My understanding is that the best aggregation I can do is get it down to one value per key, so even though I am only using the keys to specify start and end ranges and always want to return a full aggregate with a single set of counts I still have to do the final aggregation on the client side. Sorry if this is unclear. I'd be happy to clarify over mail or IRC if necessary. thanks, Cory