I am trying to run the code given in this link... MongoDB aggregation time series
Can anyone please help to run this code using java... I tried but getting unknown group operator 'hour'
My code for $match and $group :
DBObject match = new BasicDBObject("$match", new BasicDBObject("Date", new BasicDBObject("$gt", gtDate).append("$lte", lteDate)));
DBObject group = new BasicDBObject("$group",
new BasicDBObject("0",new Document("$push",new Document("doc","$Vals.0")).
append("hour", "$_id.hour").append("min", new Document("$literal",0)))
);
not sure it's right way or not.Please help