Follow by Email

Wednesday, January 13, 2016

MongoDB Query to find record using greater $gt or less than $lt operators and then sort

MongoDB Query to find record using greater $gt or less than $lt operators and then sort

Query
db.grades.find({"score":{$gt:65}},{"score":1,student_id:2,}).sort({"score:1})

grades is the collection.