MongoEngine/mongoengine — pull request #690 by claymation (2014-06-30 18:15:49+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.