Logical Operators
$and, $or, $nor and $not combine conditions. Multiple fields in one filter already mean AND.
Example
db.students.find({ $or: [ { city: "Lagos" }, { age: { $lt: 20 } } ] })
db.students.find({ age: { $not: { $gt: 30 } } })Exercise
Either condition.
{ $: [ {a:1}, {b:2} ] }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.