mongodb

how to find values between a range in mongodb


I have a db named student and I want to select the values between 30 and 60 from a column named u1. This is the query I used,but it shows some error

db.student.find($and:[{u1:{$gt:30}},{u1:{$lt:60}}])

Solution

  • try this:

    db.student.find({ u1 : { $gt :  30, $lt : 60}});