aggregation: add option to $unwind to emit array index

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Done
    • Priority: Major - P3
    • 3.1.8
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • Fully Compatible
    • Quint 9 09/18/15
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      There may be times when the index of an array element is interesting. $unwind
      could provide an option to emit this. For example

      instead of just

      db.runCommand({ aggregate:"c", pipeline:[
          { $unwind: "$arrayField"}
      ]});
      

      consider also supporting something like this:

      db.runCommand({ aggregate:"c", pipeline:[
          { $unwind: { path: "$arrayField", includeArrayIndex: boolean }}
      ]});
      

      The effect of this is the same except that it also adds a new field index
      to the output which is assigned the index of the array element.

            Assignee:
            Charlie Swanson
            Reporter:
            Daniel Pasette (Inactive)
            Votes:
            19 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved: