MongoDB Query Language (MQL) Set Expression Operators
Set expression operators perform set operations on arrays, treating them as sets of unique values. These operators enable you to perform mathematical set operations like union, intersection, difference, and subset comparisons, useful for analyzing relationships between array fields.
$allElementsTrue
The $allElementsTrue operator returns true if all elements in an array evaluate to true.
$anyElementTrue
The $anyElementTrue operator returns true if any element in an array evaluates to a value of true.
$setDifference
The $setDifference operator returns a set with elements that exist in one set but not in a second set.
$setEquals
The $setEquals operator returns true if two sets have the same distinct elements.
$setIntersection
The $setIntersection operator returns the common elements that appear in all input arrays.
$setIsSubset
The $setIsSubset operator determines if one array is a subset of a second array.
$setUnion
The $setUnion operator returns an array that contains all the unique elements from the input arrays.