Articles → MONGODB → $And Logical Operator In Mongodb
$And Logical Operator In Mongodb
Purpose
Syntax
db.collection.find({
$and: [
{ condition1 },
{ condition2 },
{ condition3 },
// More conditions if needed
]
})
Example
db.sales.find({$and: [{ "product":"A"},{ "quantity":5}]})
Output