Thuta Learning
MongoDB
IntermediateData & Databasesintermediate

Query Operators

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, ... }
Query Operators | Thuta Learning