I need to sort by a field that doesn't exist in a given collection, i.e. projecting then sorting.
This PR adds the capability of supplying a $sort pipeline direct on the aggregation, as such:
This PR also changes the order of the $limit and the default $sort operations being inserted in the pipeline to allow insert different pipelines between the $match and the $sort.
Without this change, the aggregation would resolve to:
Changes Made
I need to sort by a field that doesn't exist in a given collection, i.e. projecting then sorting. This PR adds the capability of supplying a
$sort
pipeline direct on theaggregation
, as such:Potential Risks
This PR also changes the order of the
$limit
and the default$sort
operations being inserted in the pipeline to allow insert different pipelines between the$match
and the$sort
.Without this change, the aggregation would resolve to:
Instead of what I need:
Test Plan
Checklist