title: How to query neighbor elements in MongoDB?
body: <p>I am implementing a ranking system. I have a collection with elements like this:</p>
  
  <pre><code>{"_id" : 1, "count" : 32}
  {"_id" : 2, "count" : 12}
  {"_id" : 3, "count" : 34}
  {"_id" : 4, "count" : 9}
  {"_id" : 5, "count" : 77}
  {"_id" : 6, "count" : 20}
  </code></pre>
  
  <p>I want to write a query that return an element which has <code>{"id" : 1}</code> and 2 other neighbor elements (after sorting by count). Totally 3 elements returned.</p>
  
  <p>Ex:
  After sorting:</p>
  
  <pre><code>9 12 20 32 34 77
  </code></pre>
  
  <p>The query should return <code>20 32 34</code>.</p>