MongoDB 8 · Query and update operators
Combine conditions with OR
Find documents that match either condition.
db.users.find({ $or: [{ age: { $lt: 18 } }, { age: { $gt: 65 } }] })
Official MongoDB 8 documentation
More query and update operators commands
- Match any of several values
- Search with a regular expression
- Check that a field exists
- Match inside an array
- Add to an array
- Remove from an array
All query and update operators commands · MongoDB 8 cheatsheet