MongoDB 8 · Query and update operators
Match any of several values
Find documents whose field equals one of the listed values.
db.users.find({ role: { $in: ["admin", "editor"] } })
Official MongoDB 8 documentation
More query and update operators commands
- Combine conditions with OR
- 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