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

Undocumented breakage of Model#set

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.4.0
    • Component/s: Persistence
    • None

      7.4.0 introduced an undocumented breaking change to Model#set. Assuming a User model with external_ids field of type Hash, and a record with an existing value of `{ a: 1 }`

      Set command:

       

      user.set(external_ids: { b: 2 })

       

      v7.3.x

       

      => #<User external_ids: { a: 1, b: 2 }>

       

      v7.4.0

      => #<User external_ids: { b: 2 }>

       

       

      So it seems like 7.4.x is now completely replacing the value rather than merging. Granted, this is more inline with how it should probably work, but breaking changes like this should be behind a toggle like the rest of the 7.4 changes until they are swapped in 8.0.

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            kieran@xpand.io Kieran Pilkington
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: