@@ -26,19 +26,21 @@ Definition
26
26
{ $arrayElemAt: [ <array>, <idx> ] }
27
27
28
28
The ``<array>`` expression can be any valid :ref:`expression
29
- <aggregation-expressions>` as long as it resolves to an array.
29
+ <aggregation-expressions>` that resolves to an array.
30
30
31
31
The ``<idx>`` expression can be any valid :ref:`expression
32
- <aggregation-expressions>` as long as it resolves to an integer.
32
+ <aggregation-expressions>` that resolves to an integer:
33
33
34
- - If positive, :expression:`$arrayElemAt` returns the element at the
35
- ``idx`` position, counting from the start of the array.
34
+ - If the ``<idx>`` expression resolves to zero or a positive integer,
35
+ :expression:`$arrayElemAt` returns the element at the ``idx``
36
+ position, counting from the start of the array.
36
37
37
- - If negative, :expression:`$arrayElemAt` returns the element at the
38
- ``idx`` position, counting from the end of the array.
38
+ - If the ``<idx>`` expression resolves to a negative integer,
39
+ :expression:`$arrayElemAt` returns the element at the ``idx``
40
+ position, counting from the end of the array.
39
41
40
- If the ``idx`` exceeds the array bounds, :expression:`$arrayElemAt`
41
- does not return any result.
42
+ If ``idx`` exceeds the array bounds, :expression:`$arrayElemAt` does
43
+ not return a result.
42
44
43
45
For more information on expressions, see
44
46
:ref:`aggregation-expressions`.
0 commit comments