MongoDB Query Language (MQL) Array Expression Operators

$arrayElemAt

The `$arrayElemAt` operator is used to return the element at the specified array index. This operator is helpful when you need to extract a specific element from an array within your documents.

$arrayToObject

The `$arrayToObject` operator converts an array into a single document object. This operator is useful when you need to transform arrays into key-value pairs.

$concatArrays

The `$concatArrays` operator is used to combine multiple arrays into a single array. This operator is useful when you need to merge arrays from different documents or fields in a document.

$filter

The `$filter` operator is used to filter elements from an array based on a specified condition. This operator is useful when you need to manipulate or retrieve specific array elements within documents.

$in

The `$in` operator returns a boolean indicating whether a specified value is in an array.

$indexOfArray

The `$indexOfArray` operator searches an array for an occurrence of a specified value and returns the array index of the first occurrence. If the value is not found, returns -1.

$isArray

The `$isArray` operator determines if the operand is an array. Returns a boolean.

$map

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

$objectToArray

The `$objectToArray` operator converts a document to an array of documents representing key-value pairs.

$range

The `$range` operator outputs an array containing a sequence of integers according to user-defined inputs.

$reduce

The `$reduce` operator applies an expression to each element in an array and combines them into a single value.

$reverseArray

The `$reverseArray` operator accepts an array expression and returns an array with the elements in reverse order.

$slice

The `$slice` operator returns a subset of an array.

$sortArray

The `$sortArray` operator sorts an array based on its elements or a specified sort order.

$zip

The `$zip` operator transposes an array of input arrays so that the first element of the output array contains an array of the first elements of the input arrays, the second element contains an array of the second elements, and so on.