title: Project with Match in aggregate not working in mongodb
body: <p>I am trying to fetch data based on some match condition. First I've tried this:
  Here ending_date is full date format</p>
  
  <pre><code>    Offer.aggregate([ 
      { 
          $match: { 
              carer_id : req.params.carer_id,
              status : 3
          }
      },
      {
          $group : {
              _id : { year: { $year : "$ending_date" }, month: { $month : "$ending_date" }}, 
              count : { $sum : 1 }
          }
      }], 
      function (err, res)
      { if (err) ; // TODO handle error 
           console.log(res); 
      });
  </code></pre>
  
  <p>which gives me following output:</p>
  
  <pre><code>[ { _id: { year: 2015, month: 11 }, count: 2 } ]
  </code></pre>
  
  <p>Now I want to check year also, so I am trying this:</p>
  
  <pre><code>    Offer.aggregate([
      {
          $project: {
              myyear: {$year: "$ending_date"}
          }
      },
      { 
          $match: { 
              carer_id : req.params.carer_id,
              status : 3,
              $myyear : "2015"
          }
      },
      {
          $group : {
              _id : { year: { $year : "$ending_date" }, month: { $month : "$ending_date" }}, 
              count : { $sum : 1 }
          }
      }], 
      function (err, res)
      { if (err) ; // TODO handle error 
           console.log(res); 
      });
  </code></pre>
  
  <p>which gives me following output:</p>
  
  <pre><code> []
  </code></pre>
  
  <p>as you can see, _id has 2015 as a year, so when I match year it should be come in array. But I am getting null array. Why this?</p>
  
  <p>Is there any other way to match only year form whole datetime?</p>
  
  <p>Here is the sample data</p>
  
  <pre><code>{
      "_id": {
          "$oid": "56348e7938b1ab3c382d3363"
      },
      "carer_id": "55e6f647f081105c299bb45d",
      "user_id": "55f000a2878075c416ff9879",
      "starting_date": {
          "$date": "2015-10-15T05:41:00.000Z"
      },
      "ending_date": {
          "$date": "2015-11-19T10:03:00.000Z"
      },
      "amount": "850",
      "total_days": "25",
      "status": 3,
      "is_confirm": false,
      "__v": 0
  }
  {
      "_id": {
          "$oid": "563b5747d6e0a50300a1059a"
      },
      "carer_id": "55e6f647f081105c299bb45d",
      "user_id": "55f000a2878075c416ff9879",
      "starting_date": {
          "$date": "2015-11-06T04:40:00.000Z"
      },
      "ending_date": {
          "$date": "2015-11-16T04:40:00.000Z"
      },
      "amount": "25",
      "total_days": "10",
      "status": 3,
      "is_confirm": false,
      "__v": 0
  }
  </code></pre>