I have a single document, This single document is output of an aggregation pipeline as:
match -> lookup
Document I get has an array field. Array contains multiple objects, each having a date field. I need to sort this array in descending order of date.
I can do it in java code by making a list from array and then using comparator to sort the list, and then replacing array in document with sorted list.
Can it be done in aggregation pipeline?