title: Using findOne in mongodb to get element with max id
body: <p>I am trying to retrieve one element from a mongo collection, the one with the greatest _id field. I know this can be done by querying:</p>
  
  <pre><code>db.collection.find().sort({_id: -1}).limit(1)
  </code></pre>
  
  <p>But it kind of seems unelegant and I was wondering whether there is a way to get that specific element using findOne()</p>
  
  <p>Note: I want to do this because, from what I've read in <a href="http://docs.mongodb.org/manual/reference/object-id/">ObjectId</a>, the first bytes correspond to the miliseconds since the Epoch and thus, the last element being inserted will have the greatest _id. Is there any other way to retrieve the last element inserted in a collection?</p>