- Reference >
- Operators >
- Aggregation Framework Operators >
- Aggregation Projection Expressions >
- $map (aggregation)
$map (aggregation)¶
Definition¶
Example¶
Given an input document that resembles the following:
{ skews: [ 1, 1, 2, 3, 5, 8 ] }
And the following $project statement:
{ $project: { adjustments: { $map: { input: "$skews",
as: "adj",
in: { $add: [ "$$adj", 12 ] } } } } }
The $map would transform the input document into the following output document:
{ adjustments: [ 13, 13, 14, 15, 17, 20 ] }
See also