I'm developing a monitoring system for our company's production system. This means the nature of the data I'll be storing is time-series. I picked MongoDB for this purpose, after reviewing several other databases. Events from the production system will arrive all the time, but I intend to store events in a 10-minute interval document. Eventually, documents in the collection will look like this:
{
_id: '04/25/2015 13:00',
event1_count : 130,
event2_count : 50,
event3_count : 200
},
{
_id: '04/25/2015 13:10',
event1_count : 230,
event2_count : 20,
event3_count : 400
}
The document _id: '04/25/2015 13:00' simply means it has all the events the arrived between 04/25/2015 13:00 and 04/25/2015 13:10.
Ultimately, I'll want different reports to run on the data. For example - count of events within the last 20 minutes. The result I would like to get for event count in last 20 minute is:
{
event1_count : 360,
event2_count : 70,
event3_count : 600
}
My question - is there a way to aggregate multiple fields from different documents, in one query?
BTW - it's important for me to keep the data at a 10 minute interval, because other reports will need that time resolution.