$map

The `$map` operator applies an expression to each item in an array and returns an array with the applied results.

Syntax

{
  $map: {
    input: "<array>",
    as: "<string>",
    in: "<expression>"
  }
}

Parameters

inputstringrequired

An expression that resolves to an array.

asstringrequired

A string that specifies the variable name for each element in the input array.

instringrequired

An expression that is applied to each element in the input array.