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

Cloning a document with legacy attributes set to nil throws an error

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.1
    • Affects Version/s: 6.0.0
    • Component/s: None
    • None

      To reproduce:

      class Band
        include Mongoid::Document
        field :name, type: String
      end
      
      band = Band.create
      legacy_fields = { "this_is_not_a_field" => 1, "this_legacy_field_is_nil" => nil }
      Band.collection.find(_id: band.id).update_one("$set" => legacy_fields)
      
      band.reload
      band.dup
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            emily.stolfo Emily Stolfo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: