Array Operators

OperatorDescriptionExample
$allSelects documents where the array property contains all of the passed in values.{“roles”: {“$all”: [“000000000000000000000007”, “0123456789ab0123456789ab”]}}
$elemMatchSelects documents where all properties of an array of document properties match the passed in expression. $elemMatch does not limit the results within the array, but filters the entire document for contained entries.{“c_docs”: {“$elemMatch”: {“c_foo”: “yes”, “c_bar”: true}}}
$sizeSelects documents where the size of the array property matches the passed in values.{“c_arr”: {“$size”: 20}}