-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query
Possible syntax:
{ $sortByExpr: <aggregation expression> }
Sort by salesAmount ascending:
db.users.aggregate( [ { $sortByExpr : { $sum: { $multiply: [ "$price", "$quantity" ] } } } ] )
This will allow for what currently requires $addFields + $sort + $project.
- duplicates
-
SERVER-46298 Support sorting by expressions other than field references
- Backlog