I would like to know what is the best way to do the following.
I store data of what a person has done in Mongodb like a log
e.g.
{
"date":"01-01-2002T08:20:30",
"task":"contact-lead",
"user":"username"
}
What I need is to count how many tasks where done in that day and put them in a graph like Highstock.
The command bellow will aggregate/count the number of tasks per day:
Then you just format them if needed and send it to highcharts API, but be careful because if you have a lot of data that can be slow.
The other option is to use MapReduce and periodically update the aggregate collection and use that as a source for your graphs.