title: Find Latest Object in MongoDB
body: <p>I have data in MongoDB in the form of :</p>
  
  <pre><code> {
              "_id" : 154,
              "record_id" : "001280000033x54AAA",
              "jsonData" : "",
              "user_id" : 1,
              "userName" : "abc@xyz.com",
              "backup_no" : 1
   }
  
  
   {
              "_id" : 155,
              "record_id" : "001280000033x54AAA",
              "jsonData" : "",
              "user_id" : 1,
              "userName" : "abc@xyz.com",
              "backup_no" : 2
   }
    ...
  </code></pre>
  
  <p>I want to retrieve data based on 'user_id','userName', but if a record with same record_id exists in lower 'backup_no' then i need to choose record with highest backup_no.</p>
  
  <p>I have tried to aggregate record_id's and then query but i am unable to find a solution. </p>
  
  <p>Thanks</p>