Articles → MONGODB → $All Operators In Mongodb$All Operators In MongodbIn this article, we will discuss the $all operator in MongoDB.Purpose The $all operator is used to search the value in an array field of a document that contains all the elements specified in the query.Example Consider the following collection: -We are required to search the documents where the field tags contain mongodb and nosql in any order. So, the query will be: -db.Tags.find({ "tags": { "$all": ["mongodb", "nosql"] } })Output Posted By - Karan Gupta Posted On - Friday, March 15, 2024 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
db.Tags.find({ "tags": { "$all": ["mongodb", "nosql"] } })
Query/Feedback