Operator | Description | Example |
---|---|---|
$size | Returns the size of the array argument. The argument must resolve to an array | {“$size”: “body”} |
$slice | Returns the subset of an array. | { $slice: [ [ 1, 5, 7, 9 ], 1, 2 ] } // returns [5, 7] |
$isArray | Returns true if the operand is an array | {"$isArray": [1,2,3]} |
$concatArrays | Returns an array which contains all the arrays concatenated together. | {"$concatArrays": [ [ "medable", "is"], [ "great" ] ] } //returns ["medable", "is", "great"] |
$arrayElemAt | Returns the element in the array at a specified index. | { $arrayElemAt: [ [ "purple", "orange", "yellow" ], 1 ] } //returns "orange" |