-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
With new eager loading, when relation is eager loaded and empty, it triggers extra database query on each request to association.
class Post include Mongoid::Document belongs_to :person end class Person include Mongoid::Document has_many :posts end 100.times do |i| Person.create! end # generates 102 requests to database count_queries do Person.includes(:posts).each do |person| person.posts.to_a end end