OPTIONS

$first (aggregation)

$first

Returns the first value it encounters for its group.

Note

Only use $first when the $group follows a $sort operation. Otherwise, the result of this operation is unpredictable.

ON THIS PAGE