title: Query to get last X minutes data with Mongodb
body: <p>I'm trying to query my db that have this document format:</p>
  <pre><code>{
    &quot;_id&quot; : ObjectId(&quot;520b8b3f8bd94741bf006033&quot;),
    &quot;value&quot; : 0.664,
    &quot;timestamp&quot; : ISODate(&quot;2013-08-14T13:48:35Z&quot;),
    &quot;cr&quot; : ISODate(&quot;2013-08-14T13:50:55.834Z&quot;)
  }
  </code></pre>
  <p>I can get the last records from a datetime with this query:</p>
  <pre><code>db.mycol.find({timestamp:{$gt: ISODate(&quot;2013-08-14T13:48:00Z&quot;)}}).sort({x:1});
  </code></pre>
  <p>But I'm trying to get a set with the value fields and timestamps from 18 minutes ago.</p>