title: selecting a date range is not functioning as desired in mongo
body: <p>I wish to select a range of dates using query, but it looks like I have the timezone formatted dates, however I thought these were wrapped as the date object so that I can use the date object in python/pymongo. However when I use the query, I do not get what I expect. I tried also converting date to ISODate. So my question is, should I:</p>
  
  <p>a) Reload all the date data in a different format. 
  b) Work with the dates in mongo as they are.</p>
  
  <p>Below I'm stringing together multiple options, hence the or, but for the case I have for example:</p>
  
  <pre><code>query = {}
  query["$or"] = []
  query["$or"].append({"date_object": {"$lte": time_to.isoformat(), "$gte": time_from.isoformat() } })
  </code></pre>
  
  <p>giving:</p>
  
  <pre><code>query = {'platform': {'$in': [re.compile('windows', re.IGNORECASE)]}, '$or': [{'date_object': {'$gte': '2016-04-14T18:02:02.862030', '$lte': '2016-04-28T18:02:02.862030'}}]}
  </code></pre>
  
  <p>Also if I try the following (using the datetime object), I get the same issue. </p>
  
  <pre><code>query = {}
  query["$or"] = []
  query["$or"].append({"date_object": {"$lte": time_to, "$gte": time_from } })
  
  query = {'platform': {'$in': [re.compile('windows', re.IGNORECASE)]}, '$or': [{'date_object': {'$gte': datetime.datetime(2016, 4, 15, 7, 14, 7, 269376), '$lte': datetime.datetime(2016, 4, 29, 7, 14, 7, 269376)}}]}
  </code></pre>
  
  <p>The documents are like this for example.</p>
  
  <pre><code>{
          "_id": 889,
          "date_object": [
              {
                  "$date": "2014-01-27T00:00:00.000Z"
              },
              {
                  "$date": "2015-04-20T00:00:00.000Z"
              },
              {
                  "$date": "2016-05-09T00:00:00.000Z"
              }
          ]
      }
  </code></pre>
  
  <p>So <code>_id==889</code> is returned even though the dates are not in the range specified in the original query.</p>