title: How to query date range on the MongoDB collection where the ISO date is stored in string field?
body: <p><strong>Scenario</strong>: Consider I am having a collection called <code>MyCollection</code>, with following data:</p>
  
  <pre><code>{
      "_id" : 'MyUniqueID_01'
      "CreatedTime" : "2013-12-01T14:35:00Z",
      "LastModifiedTime" : "2013-12-01T13:25:00Z"
  }
  </code></pre>
  
  <p>Now I want to query the MongoDB database where the above mentioned kind of data is in huge number of documents. And my query is based on date range i.e. using <code>$gt</code>, <code>$gte</code>, <code>$lt</code> &amp; <code>$lte</code></p>
  
  <p>So my query may be something like:</p>
  
  <pre><code>db.MyCollection.find({ 'CreatedTime': {$gt: '2013-05-25T09:29:40.572Z'}})
  </code></pre>
  
  <p>Considering the above examples the expected result is, query has to get a document (since the "CreatedTime" : "2013-12-01T14:35:00Z" is greater than value passed in query '2013-05-25T09:29:40.572Z'); whereas it not, the issue is that field <code>CreatedTime</code> is in string format.</p>
  
  <p><strong>Question</strong>: Is there any way so that I can get my expected result perfectly without changing the string field type to date?</p>