title: Query on top N rows in mongodb
body: <p>I want to fetch 100 records from a student collection sort by name. Now i want to get student who has marks greater than x in this 100 records only. Can any one please help in solving this. When i give Max(marks) in query it is executing before the sort and skip.</p>
  
  <p>This the query i tried</p>
  
  <pre><code>var query = {};
  query["marks"] = {$gt:35};
  db.collection("student").find(query).skip(0).limit(100).sort("name")
  </code></pre>