title: Why are dates in match aggregate query being ignored?
body: <p>I'm trying to run an aggregation statement in my mongo db. I have a document whose structure is (at least) as follows:</p>
  
  <pre><code>{
     "_id": ObjectId,
     "date": ISODate,
     "keywordGroupId": NumberLong,
     "ranking": NumberLong,
  }
  </code></pre>
  
  <p>I would like to run an aggregation statement that aggregates the 'ranking' field for a given 'keywordGroupId' and a given 'date' interval.</p>
  
  <p>I have been trying with the following aggregate command:</p>
  
  <pre><code>{ 
      aggregate : "KeywordHistory", 
      pipeline : [
          { $match: { keywordGroupId: 75 , "$date": {$gte: ISODate("2013-01-01T00:00:00.0Z"), $lt: ISODate("2013-02-01T00:00:00.0Z")}} },
          { $group: { _id: { null }, count: { $sum: "$ranking" } } }
      ]
  }
  </code></pre>
  
  <p>This command executes without errors and returns a result. If I try to change the value for the 'keywordGroupId' field, the command returns a different value, so I assume that the $match statement works for that field (NumberLong). Though, if I change the 'date' range and I specify a time interval for which I don't have any data in the database, it still returns a result (I would actually expect an empty result set). So I have to assume that the $match statement is ignoring the date interval specified. </p>
  
  <p>Can anyone help me with this point?</p>