How to efficiently model transaction data for hourly, daily, weekly, and monthly reporting

I’m working on a problem requires providing reports over different time periods the analysts.
Each transaction has a buyer id, product id, price, and date.
How can I model my data to easily create periodic reports on the sum of the prices for each product id and buyer id without having to create separate collections for each reporting period?

All these reports should be updated as a new transaction comes in within 5 minutes.

Hi @peter_g ,

This sounds like a classic case for timeseries collection and window functions.

I recommend to read the following article:

Thanks
Pavel