Comparison Operators
$eq, $ne, $gt, $gte, $lt, $lte, $in and $nin compare values. Combine several on one field for a range.
Example
db.students.find({ age: { $gte: 18, $lt: 30 } })
db.students.find({ city: { $in: ["Lagos", "Accra"] } })Exercise
Greater than.
{ age: { $: 18 } }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.