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

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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0.0
    • Component/s: None
    • Labels:
      None
    • Sprint:
      Ruby Sprint 35

      Description

      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?

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: