- Reference >
- Operators >
- Aggregation Pipeline Operators >
- Group Accumulator Operators >
- $last (aggregation)
$last (aggregation)¶
On this page
Definition¶
-
$last
¶ Returns the value that results from applying an expression to the last document in a group of documents that share the same group by a field. Only meaningful when documents are in a defined order.
$last
is an accumulator operator available only in the$group
stage.$last
has the following syntax:For more information on expressions, see Expressions.