- Reference >
- Operators >
- Aggregation Pipeline Operators >
- Group Accumulator Operators >
- $first (aggregation)
$first (aggregation)¶
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 an accumulator operator available only in the$groupstage.$firsthas the following syntax:For more information on expressions, see Expressions.