Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-1269

Provide an enum for $sort stage

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • builder-0.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Reporter:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: