Thuta Learning
MongoDB
IntermediateData & DatabasesIntermediate

Query Operators

MongoDBLesson 10

Query operators let you build more sophisticated queries. Every operator starts with $.

• $eq: Equal — matches this value

• $gt: Greater Than — bigger than this value

• $lt: Less Than — smaller than this value

• $in: matches any value found in an array

javascript
// Find all documents where qty is greater than 80
db.inventory.find( { qty: { $gt: 80 } } )
You should see
{ _id: ..., item: 'paper', qty: 100, ... } { _id: ..., item: 'canvas', qty: 100, ... } { _id: ..., item: 'mat', qty: 85, ... }

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Query Operators | Thuta Learning