- Reference >
- Operators >
- Aggregation Pipeline Operators >
- $first (aggregation accumulator)
$first (aggregation accumulator)¶
On this page
Definition¶
-
$first¶ Returns the value that results from applying an expression to the first document in a group of documents that share the same group by key. Only meaningful when documents are in a defined order.
$firstis only available in the$groupstage.Disambiguation
The following page describes the accumulator
$first, available only within the$groupstage. For the array operator$first, refer to the$first (array operator)instead.