What does $or do?
$or is a logical operator that selects documents satisfying at least one of the conditions.
Example:
js
db.users.find({
$or: [
{ age: { $lt: 18 } },
{ isActive: false }
]
})This query returns documents where age is less than 18 or the user is inactive.
The gist of it: $or is a logical "OR" between conditions.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.