Skip to main content

$map

The $map operator transforms each element in an array using a provided transformation.

Input

  • An array containing an array to map and a transformation to apply to each element

Output

  • A new array containing the transformed elements

Examples

Map Numbers to Doubles

Result: [2, 4, 6, 8, 10]

Transform Objects

Result: ["Alice is 25 years old", "Bob is 30 years old"]