Add .replaceRoot to AggregationCursor

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 3.0.0
    • Affects Version/s: 2.2.22
    • Component/s: MongoDB 3.4
    • None
    • None
    • None
    • None
    • None
    • None

      MongoDB 3.4+ supports a $replaceRoot stage while aggregating: https://docs.mongodb.com/manual/reference/operator/aggregation/replaceRoot/#pipe._S_replaceRoot

      `lib/aggregation_cursor.js` seems to define prototype / class methods for method chaining instead of using an array/object-based raw pipeline. `.replaceRoot(

      { newRoot: '$xyz' }

      )` isn't available there yet and I'd like to add it to make our code (which uses chaining elsewhere) consistent.

      I would be happy to submit a pull request for this, the only thing I was unsure about was how to limit the command to servers of version 3.4+ only, and whether this is necessary. Can someone advise me on this?

            Assignee:
            Matt Broadstone
            Reporter:
            Geordie J
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: