Database
To report bugs, please use our SERVER JIRA project.
1 result found
-
Add $sort as an array operator in the agg framework
$filter and $map and $reduce allowed us to stop using $unwind all the time. I know $sort is likely the most computationally expensive peer function to $filter and $map but there are so many times that I have a field with an array of things (scalars or objects) and I need either the whole array in a sorted order or the first or last thing in the sort, for which I would use $arrayElemAt:[ {$sort: {input: ... }}, 0 ] . I see the $sort function signature looking almost like $filter:
{$sort: {input: <expr that evals to array>,
as: "gg"…1 votefeel tree to add comments if $sortArray doesn't meet your expectations
- Don't see your idea?