$lastN can be used as an aggregation accumulator or array operator. As an aggregation accumulator, it an aggregation of the last n elements within a group. As an array operator, it returns the specified number of elements from the end of an array.
5.2
https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#mongodb-group-grp.-lastN
$lastN can be used as an aggregation accumulator or array operator. As an aggregation accumulator, it an aggregation of the last n elements within a group. As an array operator, it returns the specified number of elements from the end of an array.