Tsallaka zuwa abun ciki
Justice Tech School

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

What does a filter with two fields mean?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.