title: mongodb query to get documents within two date range
body: <p>my documents have a field with date type as below.</p>
  
  <pre><code>{ 
      "_id" : ObjectId("568bae0fcfe23a50879d45fc"),
      "data": {
            "createdDate" : ISODate("2015-12-17T22:25:24.973+0000")
      }
  }
  </code></pre>
  
  <p>how can i get all documents where <strong>data.createdDate</strong> &lt;= todayDate and <strong>data.createdDate</strong> >= todayDate-20days.</p>
  
  <p>i tried  with below query, which is working fine.</p>
  
  <pre><code>db.myTable.aggregate([
      {$match: {"data.createdDate": {$lte: new Date(), $gte: new Date(new Date().setDate(new Date().getDate()-20))}}}
  ])
  </code></pre>
  
  <p>but this query considers time also. I want to compare only with respect to date.  </p>