i want to display a graph of how many visits occur per hour divided per day, in my collection i have objects like this:
{
"_id" : ObjectId("5ab111a0646e371568c8cfa0"),
"date" : ISODate("2018-03-20T13:46:30.018Z"),
"__v" : 0
}
i tried to use the .mapReduce() as specified here https://docs.mongodb.com/manual/aggregation/ and something like this:
db.getCollection('monitors').mapReduce(function(){emit(this.date);}, function(key,values){return Array(values)}, {query: date:'"2018-03-20T13:46:30.018Z"'}, out:"order_totals"})
just to try to collect all the visits in that day but it doesn't work.