title: Need to aggregate by hour and $avg not recognized
body: <p>From a MongoDB collection storing data with time stamps I need to return a single record for each hour. </p>
  
  <p>So far I have selected the set of records between two dates successfully, but I cant figure how to build the hourly record I need in the <code>$group</code> clause. </p>
  
  <pre><code>var myName = "CollectionName"
  //schema for mongoose
  var mySchema = new Schema({
      dt: Date,
      value: Number
  });
  
  var myDB = mongoose.createConnection('mongodb://localhost:27017/MYDB');
  
  myDBObj = myDB.model(myName, evalSchema, myName);
  </code></pre>
  
  <p>The match in this aggregate call works fine, and the <code>$hour</code> creates a record for each hour in the day..  but I don't know how to recreate the a full date and get an error <code>"unknown group operator $avg"</code> ... </p>
  
  <pre><code>myDBObj.aggregate([
          {
              $match: { "dt": { $gt: new Date("October 13, 2010 12:00:00"), $lt: new Date("November 13, 2010 12:00:00") } }
          },{
              $group: {
              "_id": { "dt": { "$hour": "$dt" } , "price": { "$avg": "$price" }}
  
          }], function (err, data) { if (err) { return next(err); } res.json(data); });
  </code></pre>
  
  <p>I think I need to use <code>$dayOfYear</code> so there is different records for each hour of each day, and include a <code>new Date()</code> somewhere ...  </p>
  
  <p>Can someone help me do this correctly? any help is appreciated.</p>