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

defaults count as "changed"

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

      If a document is fetched with limited fields which don't include a field with a default, and then updated, the field with a default is set.

      That is:

      class Thing
      field :field, default: "just the default"
      end

      thing = Thing.new(field: "not default")
      thing.save!
      thing2 = Thing.where(_id: thing.id).only(:_id)
      thing2.update
      thing3 = Thing.find(thing.id)
      thing3.field #=> "just the default"

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

              Created:
              Updated:
              Resolved: