Mongoengine: Cannot query and filter fields of subclasses of embedded documents

Created on 22 Sep 2013  路  6Comments  路  Source: MongoEngine/mongoengine

Tested on 0.8.4.

from mongoengine import *

connect('test')

class BaseSettings(EmbeddedDocument):
    meta = {'allow_inheritance': True}

class AdminSettings(BaseSettings):
    foo = StringField()

class Person(Document):
    settings = EmbeddedDocumentField(BaseSettings)

Person.objects(settings__foo='bar') # raises 'Cannot resolve field "foo"'
Person.objects.only('settings.foo') # raises 'Cannot resolve field "foo"'

Most helpful comment

I can still reproduce it in 0.10.6.

744 solves this problem for Document subclasses, not EmbeddedDocument subclasses.

All 6 comments

Will fix in 0.9

Any plan for 0.9 release?

Person.objects(settings__foo='bar') exception already solved with #744

I can still reproduce it in 0.10.6.

744 solves this problem for Document subclasses, not EmbeddedDocument subclasses.

Any news?

Any updates? I'm also running into this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZEROF picture ZEROF  路  4Comments

MaXXXXfeng picture MaXXXXfeng  路  3Comments

MateuszBelczowski picture MateuszBelczowski  路  4Comments

ibrahimyilmaz picture ibrahimyilmaz  路  5Comments

knoxxs picture knoxxs  路  3Comments