title: Group By Hour using UNIX time stamp in mongodb
body: <p>I required records with the output of gender, count, and updated hour for two days.</p>
  
  <pre><code>db.FaceData.aggregate([ {$match: { 'Timestamp' : { $gte : 1448121600000, $lt : 1448294399000 }, 'DID' : "ABFR001" }},  {$group: { _id: {'Gen': '$Gen'},  count : { $sum : 1 } }}  ]);
  output:
   ------
  { "_id" : { "Gen" : 1 }, "count" : 3055 }
  { "_id" : { "Gen" : 0 }, "count" : 2866 }
  </code></pre>
  
  <p>In the above output I have to group by hour for two days, For Example, Every hour I need Gender, Count for 2days.</p>
  
  <p>Timestamp is in millisecond.</p>