Sure thing, opened here:
https://github.com/mongoid/mongoid/issues/1542
Thanks for the awesome gem and amazing work! Mongoid is really a
thing of beauty.
On Dec 31 2011, 3:19 am, Durran Jordan <
dur...@gmail.com> wrote:
> Can you open a Github issue for it please? I completely forgot about this:
> eager loading is not taking limit into account.
>
> 2011/12/31 Brian <
barmstr...@gmail.com>
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > I have a fairly standard has_many/belongs_to relationship.
>
> > class Post
> > include Mongoid::Document
> > has_many :comments
> > ...
> > end
>
> > class Comment
> > include Mongoid::Document
> > belongs_to :post
> > ...
> > end
>
> > And when I do a query like this:
>
> > Post.includes(:comments).limit(10)
>
> > It seems to load every comment in a first query, before getting
> > posts. (not just for the 10 posts)
>
> > MONGODB myapp_development['system.namespaces'].find({})
> > MONGODB myapp_development['posts'].find({}, {"_id"=>1})
> > MONGODB cursor.refresh() for cursor 8721222270629761565
> > MONGODB myapp_development['system.namespaces'].find({})
> > MONGODB
>
> > myapp_development['comments'].find({"post_id"=>{"$in"=>[BSON::ObjectId('4ef a72f40d3bf62eec0048e8'),