Provide an enum for $sort stage

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • builder-0.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • 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

              Assignee:
              Jérôme Tamarelle
              Reporter:
              Jérôme Tamarelle
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: