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

Using mongoid 'only' or 'without' creates read-only objects

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

      I noticed some changes in the way loading an instance with 'only' or 'without' behaves in beta 1. It now fortunately throws errors when a field is accessed which isn't loaded. But it also marks the object as read only preventing us from changing and then saving the object.
      Is this really what you want to do? A pretty common use case scenario is that documents are relatively big and you only need to change a couple of fields; querying just those fields, making modifications and then saving the object used to work great.
      Would it not be better to just throw errors when trying to access or save unloaded fields?

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

              Created:
              Updated:
              Resolved: