MongoEngine/mongoengine — pull request #682 by claymation (2014-06-29 00:37:09+00:00)
Title: Follow ReferenceFields in EmbeddedDocuments with select_related

For the following structure:

class Playlist(Document):
items = ListField(EmbeddedDocumentField("PlaylistItem"))

class PlaylistItem(EmbeddedDocument):
song = ReferenceField("Song")

class Song(Document):
title = StringField()

this patch prevents the N+1 queries otherwise required to fetch all
the `Song` instances referenced by all the `PlaylistItem`s.