- Reference >
- Operators >
- Aggregation Pipeline Operators >
- Aggregation Variable Operators >
- $map (aggregation)
$map (aggregation)¶
On this page
Definition¶
-
$map
¶ Applies an expression to each item in an array and returns an array with the applied results.
The
$map
expression has the following syntax:Field Specification input
An expression that resolves to an array. as
The variable name for the items in the input
array. Thein
expression accesses each item in theinput
array by this variable.in
The expression to apply to each item in the input
array. The expression accesses the item by its variable name.For more information on expressions, see Expressions.