MongoDB Set Operators
MongoDB set operators are a group of special operators used to manipulate collection-type fields, including set union, set difference, set intersection, etc. They can be used for various operations on sets in both aggregation queries and regular queries. This page lists the set operators available in MongoDB.
-
$allElementsTrue
$allElementsTrue
is a logical operator in MongoDB used to test whether all elements in an array field are true. -
$anyElementTrue
$anyElementTrue
is an operator in MongoDB’s query language used to match array fields that contain at least one element that istrue
. -
$setDifference
The MongoDB$setDifference
operator is one useful operator that is used to get the different elements between two collections. -
$setEquals
$setEquals
is a set operator in MongoDB that can be used to compare whether two sets are equal. -
$setIntersection
$setIntersection
is an array operator in MongoDB that returns the intersection of two arrays. -
$setIsSubset
$setIsSubset
operator is an array operator in MongoDB, used to determine if an array is a subset of another array, and returns a Boolean value. -
$setUnion
$setUnion
is an aggregation operator in MongoDB that merges two arrays into a single array and removes duplicates.