eager loading feature

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 2.2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I add the eager loading feature for mongoid, just like ActiveRecord3, so you can use such syntax <code>Post.limit(20).includes(:person).each

      { |post| puts post.person.name }

      </code>.

      ActiveRecord3 has two options for eager loading, one is JOIN, the other is to use two sql queries. As mongodb doesn't support JOIN, so I just implement eager loading as two queries for mongoid.

      I also did a benchmark for eager loading, about 20% improvement, http://gist.github.com/619142

              Assignee:
              Unassigned
              Reporter:
              Richard Huang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: