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

Identity_map = true + #only contagion

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.0.0 final
    • Component/s: None
    • Labels:

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: