db.users.find({age: {$gt: 30}})

Category: Databases & SQL

db.users.find({age: {$gt: 30}})

Find documents matching a filter

Returns every user whose age is greater than 30. The filter is a JSON document and $gt is the greater-than operator; other operators include $lt, $in, and $regex. Add .limit(10) or .sort({age: 1}). Related: findOne.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.