I'm pretty new with MongoDB, long time MySQL guy and am running into a little roadblock.
Given the below sample data:
TeamID Day OrderAmount
100 4/1 50
100 4/1 40
200 4/2 50
100 4/2 20
I'm trying to find the average team order amounts per day. I'm able to do a simple query using mapReduce function to do a group by with the TeamId & Day. So now I have:
TeamID Day AvgAmount
100 4/1 45
200 4/2 50
100 4/2 20
Now I'm trying to roll that data up to get the average order amount per team per day which would be:
Day AvgAmount
4/1 47.5
4/2 35
I can do this easily with MySQL but am having trouble figuring out how to do this with MongoDB without doing it manually in the app side rather than doing it with MongoDB.