mongoDB – $all operator

The $all operator is used to selects the documents with the value of field is an array that contains all given elements.

where the value of a field is an array that contains all the specified elements. This operator behaves like

$and
operator.  $all syntax is

This query will return all documents with degrees as “BS” and “MS”.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.