-
Type: Task
-
Resolution: Done
-
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