Array Aggregation OperatorsΒΆ


For details on specific operator, including syntax and examples, click on the specific operator to go to its reference page.

Name Description
$arrayElemAt Returns the element at the specified array index.
$arrayToObject Converts an array of key value pairs to a document.
$concatArrays Concatenates arrays to return the concatenated array.
$filter Selects a subset of the array to return an array with only the elements that match the filter condition.
$in Returns a boolean indicating whether a specified value is in an array.
$indexOfArray Searches an array for an occurence of a specified value and returns the array index of the first occurence. If the substring is not found, returns -1.
$isArray Determines if the operand is an array. Returns a boolean.
$map Applies a subexpression to each element of an array and returns the array of resulting values in order. Accepts named parameters.
$objectToArray Converts a document to an array of documents representing key-value pairs.
$range Outputs an array containing a sequence of integers according to user-defined inputs.
$reduce Applies an expression to each element in an array and combines them into a single value.
$reverseArray Returns an array with the elements in reverse order.
$size Returns the number of elements in the array. Accepts a single expression as argument.
$slice Returns a subset of an array.
$zip Merge two arrays together.