Sequence NODE_278
Easy

Use $in and $or to Filter Products

MongoDB
Technical Specification

Query products that are either in categories ['laptop', 'mobile'] OR have price less than 5000.

Input/Output Samples
Input:categories = laptop/mobile, price < 5000
Output:All matching products
Optimal Logic Path
db.products.find({
  $or: [
    { category: { $in: ["laptop", "mobile"] } },
    { price: { $lt: 5000 } },
  ],
});
Architectural Deep-Dive
$in and $or are powerful query operators for combining multiple conditions logically.