-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
The $sort stage accepts a map of field names to sort order.
SortOrder enum can be:
- Ascending: 1
- Descending: -1
- TextScore (TBD)
- Various other meta operators
The method signature should be:
function sort(SortOrder|int ...$fields)
Usage:
Stage::sort(created_at: SortOrder::Ascending);
Stage::sort(... ['tags.id' => SortOrder::Descending]);
Implement the Text Score Metadata Sort Example.
Sort specifications are also used by:
- $bottom
- $bottomN
- $sortArray
- $top
- $topN
- $fill
$setWindowFields
- links to