OPTIONS

$setUnion (aggregation)

$setUnion

New in version 2.6.

Takes any number of arrays and returns an array containing the elements that appear in any input array.

Important

$setUnion takes arrays as arguments and treats these arrays as sets. $setUnion ignores duplicate entries in input arrays and produce arrays that contain unique entries.