Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4589

aggregation: need an array indexing operator

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.5
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • Sprint:
      Quint Iteration 4, Quint Iteration 5

      Description

      At present, there's no way to extract a specific element from an array-valued field. An operator should be added that could be used in a projection, e.g.:

      db.runCommand({aggregate:"c", pipeline:[
      { $project : {
      foo :

      { $at:["$arrayField", 5] }

      }}
      ]});

      The effect of this would be put add the computed field (virtual field) foo to the projection, and give it the value of arrayField[5].

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                75 Vote for this issue
                Watchers:
                48 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: