$sortArray
The `$sortArray` operator sorts an array based on its elements or a specified sort order.
Syntax
{
$sortArray: {
input: "<array>",
sortBy: "<sort specification>"
}
}
Parameters
input
stringrequiredAn expression that resolves to an array.
sortBy
objectrequiredA document specifying the sort order. Use 1 for ascending, -1 for descending.