In many mapping scenarios, a source document might contain one or more JSON arrays. In order to map an array like that to a different array on the target document, you need to specify a list context (see Mapping Loops).
Previously, you could only loop over all items on the source array and map each item, but it was not possible to change the order of the array elements or exclude certain array items from the result.
Today, we are adding support for JSONata functions usage when setting a List Context. With the support from $filter, $sort, $reverse, and other functions you should be able to translate an array of any shape to the desired format.
For example, assuming that the
orders below are coming in a random sorting order, you can adjust that order and sort the result by
orderDate before mapping them to