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

Identity_map = true + #only contagion

    • Type: Icon: Task Task
    • Resolution: Done
    • 4.0.0 final
    • Affects Version/s: None
    • Component/s: None

      Using mongoid 3.1.x

      When identity map is enabled, the #only modifier is erroneously applied to queries where you do not intend it to be applied, causing unexpected nil values.

      The issue is described here in detail:
      https://groups.google.com/forum/#!msg/mongoid/QsyYKiA0qYI/zxWds9Ccn5wJ

      This is a particularly nasty limitation, as a query in one part of your code can blow-up a completely different area depending on call order (as it did for me, and I spent a few hours scratching my head!)

      I propose to enhance identity map to handle only safely by default, or else make the unit_of_work(disable: current) wrapper the default behavior for #only

      I'd also recommend to mention this issue in bold red font in the docs: http://mongoid.org/en/origin/docs/options.html

            Assignee:
            arthurnn Arthur Nogueira Neves
            Reporter:
            johnnyshields Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: