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

Allow $[] syntax for specifying array indexes in updates

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query Optimization

      The update expression

      {$set: {"a.$[5]": 0}}
      

      should update the element at position 5 of array a to 0. This syntax should be used for updating arrays in oplog entries instead of

      {$set: {"a.5": 0}}
      

      which is ambiguous as to whether it means the array element at position 5, or a field of an object with name "5".

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: