-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
class Orange
include Mongoid::Document
field :a
end
class Apple
include Mongoid::Document
field :a
end
Orange.create!
query = Apple.with(collection: "oranges")
Apple.count
query.count ## should == 1 but actually is 0
I'm running into concurrency issues with multiple processes in which I do
Apple.with(collection: "oranges").count should return 1 but instead returns 0 because in between when the query happens something else (different process/thread) accesses Apple and resets the overridden collection name.