title: MongoDB group by hour
body: <p>I save tweets to mongo DB:</p>
  
  <pre><code> twit.stream('statuses/filter', {'track': ['animal']}, function(stream) {
      stream.on('data', function(data) {
          console.log(util.inspect(data));
  
          data.created_at = new Date(data.created_at);
          collectionAnimal.insert(data, function(err, docs) {});
      });
  });
  </code></pre>
  
  <p>It's OK.</p>
  
  <p>The tweet time in MongoDB is in format: 2014-04-25 11:45:14 GMT (column created_at)
  Now I need group column created_at in hours. I would like to have the result:</p>
  
  <p>hour | count tweets in hour</p>
  
  <hr>
  
  <p>1    |  28</p>
  
  <p>2    |  26</p>
  
  <p>3    |  32</p>
  
  <p>4    |  42</p>
  
  <p>5    |  36</p>
  
  <p>...</p>
  
  <p>My unsuccessful attempt:</p>
  
  <pre><code>    $keys = array('created_at' =&gt; true);
      $initial = array('count' =&gt; 0);
      $reduce = "function(doc, prev) { prev.count += 1 }";
  
      $tweetsGroup = $this-&gt;collectionAnimal-&gt;group( $keys, $initial, $reduce );
  </code></pre>
  
  <p>But my not able to group by hour.</p>
  
  <p>How to do it?</p>