OPTIONS

$setDifference (aggregation)

$setDifference

New in version 2.6.

Takes two arrays and returns an array containing the elements that only exist in the first array.

Important

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