Articles → MONGODB → $Or And $Nor Logical Operators In MongoDB

$Or And $Nor Logical Operators In MongoDB






$Or





$Or Example




Picture showing the sample sales collection in MongoDB




db.sales.find({$or:[{product:'A'}, {product:'B'}]})




Picture showing how the data is fetched using the $or operator



$Nor





$Nor Example




db.sales.find({$nor:[{product:'A'}, {product:'B'}]})


Picture showing how the data is fetched using the $nor operator





Posted By  -  Karan Gupta
 
Posted On  -  Thursday, February 15, 2024

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250