- 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.
$first
is only available in the$group
stage.Disambiguation
The following page describes the accumulator
$first
, available only within the$group
stage. For the array operator$first
, refer to the$first (array operator)
instead.