DocumentDB LogoDocumentDB
HomeGitHubDiscordDocsPackagesBlogs
Back to DocumentationMQL Documentation
Commands
Aggregation
Query And Write
Operators
Accumulators
Aggregation
Arithmetic Expression
Array Expression
Array Query
Array Update
Bitwise
Bitwise Query
Bitwise Update
Comparison Query
Conditional Expression
Data Size
Date Expression
Element Query
Evaluation Query
Field Update
Geospatial
Literal Expression
Logical Query
Miscellaneous
Miscellaneous Query
Object Expression
Projection
Set Expression
$allElementsTrue
$anyElementTrue
$setDifference
$setEquals
$setIntersection
$setIsSubset
$setUnion
Timestamp Expression
Variable Expression
Window Operators
Reference/Operators/Set Expression

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.

Copyright © DocumentDB a Series of LF Projects, LLC. For web site terms of use, trademark policy and other project policies please see https://lfprojects.org.