Applies an expression to each item in an array and returns an array with
the applied results.
public map ( mixed | self $input, string $as, mixed | self $in ) | ||
$input | mixed | self | An expression that resolves to an array. |
$as | string | The variable name for the items in the input array. The in expression accesses each item in the input array by this variable. |
$in | mixed | self | The expression to apply to each item in the input array. The expression accesses the item by its variable name. |
/** * Applies an expression to each item in an array and returns an array with * the applied results. * * @see http://docs.mongodb.org/manual/reference/operator/aggregation/map/ * @see Expr::map * @param mixed|Expr $input An expression that resolves to an array. * @param string $as The variable name for the items in the input array. The in expression accesses each item in the input array by this variable. * @param mixed|Expr $in The expression to apply to each item in the input array. The expression accesses the item by its variable name. * @return self */ public function map($input, $as, $in) { $this->expr->map($input, $as, $in); return $this; }