Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-8218

Wrong preview on bulk update modal

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.44.0
    • Affects Version/s: 1.43.6
    • Component/s: None
    • None
    • Environment:
      OS: Windows 11
    • 2
    • Not Needed
    • Developer Tools

      Problem Statement/Rationale

      When trying to preview the update of a call with an agg pipeline defined using  $map and $mergeObjects, the indexes from the original data array will show duplicate values, and the result may have also wrong values if the array has more than 10 elements. If you run the update code, the result seems to be correct (at least in the cases I have tried)

      See screenshot for easier understanding

      Steps to Reproduce

      in any collection with a  field that contains an array of objects, open update modal, use an array with the agreggation pipeline defining new fields with a $map like for example (in my case the array field is called eventDefaults) 

      [ { $set: { "eventDefaults": { $map: { input: "$eventDefaults", as: "elem", in: { $mergeObjects: [ "$$elem", { "newField": 1 } ] } } } } } ] 

      Expected Results

      Preview shows the right indexes for existing and new data

      Actual Results

      wrong indexes (duplicated on original array and with strange values on the new one)

       

        1. image-2024-08-27-13-19-33-914.png
          71 kB
          Toni Lytesoft
        2. image-2024-08-28-12-35-08-691.png
          67 kB
          Toni Lytesoft

            Assignee:
            leroux.bodenstein@mongodb.com Le Roux Bodenstein
            Reporter:
            toni@lytesoft.com Toni Lytesoft
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: