title: In mongodb how to get the highest count of salary
body: <p>In Mongo db I have some sample data as follows:</p>
  
  <p><strong>Object 1</strong> </p>
  
  <pre><code>{
   'id': 1,
   'name': 'ram',
   'age': 25,
   'group': 'developer',
   'salary': 30000
  }
  </code></pre>
  
  <p><strong>Object 2</strong></p>
  
  <pre><code>{
   'id': 2,
   'name': 'sai',
   'age': 27,
   'group': 'developer',
   'salary': 45000
  }
  </code></pre>
  
  <p>This is some sample data in the mongodb and I have so many objects all related to employee details.</p>
  
  <p>From this data how to get the 1st or 2nd or 3rd highest salary and the details. So query should be like if i want 3rd highest salary it has to give me the all the details of matching document even if the salary is changed. <strong>The query should not need to be changed if the salary is increased.</strong></p>