Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2260

UpdateMany doesn't support links to existing fields

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Core API
    • None

      Summary

      Go driver's UpdateMany doesn't update fields using existing fields in object.
       
      col.UpdateMany(ctx,bson.M{“id”:123},bson.D{"$set", bson.D{“PreviousRecord”,"$CurrentRecord")}}

      This command will update object:
      {{

      { id:123, PreviousRecord:"old", CurrentRecord:"new" }

      }}

      as:
      {{

      { id:123, PreviousRecord:"$CurrentRecord", CurrentRecord:"new" }

      }}

      MongoDB 4.4 (docker image mongo:4.4); GO-driver 1.7.1

       

       

        1. setfieldinupdate.go
          1 kB
          Benji Rewis

            Assignee:
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            Reporter:
            slavik-undead@mail.ru Apocalypsy .
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: