#find_and_modify does not update an object in the Mongoid::IdentityMap

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 3.0.5
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      find_and_modify isn't updating an object in the identity map. It's fairly easy to see, just do something like this:

      band = Band.create(name: "Tool")
      Band.where(_id: band.id).find_and_modify(:$push => {notes: {text: 'Hello'}})
      band.reload()
      band.notes.length
      # => 1
      Band.find(band.id).notes.length
      # => 0
      

      Changing the find_and_modify to an update works as expected.

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

              Created:
              Updated:
              Resolved: