Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1608

Aggregation should have a $reverseArray expression.

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: Linq
    • Labels:
      None
    • Sprint:
      C# Sprint 41

      Description

      Syntax

      {$reverseArray: <expression which evaluates to an array>}
      

      Examples

      Input

      {_id: 0, a: [1, 2, 3]}
      

      Pipeline

      db.coll.aggregate([{
          $project: {
              reversed: {$reverseArray: "$a"}
          }
      }])
      

      Output

      {_id: 0, reversed: [3, 2, 1]}
      

      Additional Notes

      • Can be used in combination with $reduce to yield the equivalent of a $foldR.
      • Returns null if input is nullish.
      • Errors if input is not an array or nullish.

      Original Description

      Aggregation should support an $reverseArray expression, which accepts as input an expression that evaluates to an array, and outputs the reversed version of the array. Throws an error if the input is not an array or nullish.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              craiggwilson Craig Wilson
              Reporter:
              rathi.gnanasekaran Rathi Gnanasekaran
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: