If I have the following schema:
class Post(EmbeddedDocument):
title = StringField(max_length=120, required=True)
meta = {'allow_inheritance': True}
class TextPost(Post):
content = StringField()
class MoviePost(Post):
author = ReferenceField(Authors)
class Record(Document):
posts = ListField(EmbeddedDocumentField(Post))
And I do the following query:
author = Author.objects.get_or_404(id = id)
records = Record.objects(posts__author = author)
records.count()
I get the following error:
AttributeError: 'author' object has no attribute 'get'
This seems to only happen with allow_inheritance when certain objects may or may not have the 'author' field. If the field exists on all objects, such as the 'title' field, the query works fine.