Returns an aggregation of the maxmimum value n elements within a group.
If the group contains fewer than n elements, $maxN returns all elements in the group.
$maxN(collection, expr, options): unknown
Parameters
collection: unknown[]
The input array
expr: unknown
The right-hand side expression value of the operator
Returns an aggregation of the maxmimum value n elements within a group. If the group contains fewer than n elements, $maxN returns all elements in the group.