Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3057

`document.atomically` does only the last `add_to_set`

    • Type: Icon: Task Task
    • Resolution: Done
    • 4.0.0 final
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      class Image
        include Mongoid::Document
        field :uploaded, type: Array
      end
      
      image = Image.create
      
      image.atomically do
        image.add_to_set(:uploaded => '123')
        image.add_to_set(:uploaded => '456')
      end
      
      # MOPED: 127.0.0.1:27017 UPDATE       database=development collection=images selector={"_id"=>"51925dffc823202150000001"} update={"$addToSet"=>{"u"=>{"$each"=>["456"]}}} flags=[] (0.2313ms)
      
      # Gemfile
      rails (4.0.0.rc1)
      
      # Gemfile.lock
      GIT
        remote: git://github.com/mongoid/mongoid.git
        revision: df7f1fdd419c8613d53952992d9f5d233292db36
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            bnorton bnorton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: