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

aggregation: need an array indexing operator

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.5
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • Minor Change
    • Quint Iteration 4, Quint Iteration 5

      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].

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            75 Vote for this issue
            Watchers:
            46 Start watching this issue

              Created:
              Updated:
              Resolved: