-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Hi There,
I had an issue today while using DynamicDocument on a collection that makes use of some inheritance.
Note that using .exclude('_cls') is solving my problem but I thought it could be good to let you know.
Below is a reproducible scenario. BTW mongoengine is awesome, thanks for the hard work!
class Geek(Document):
meta = {'allow_inheritance': True}
name = StringField()
class AwesomeGeek(Geek):
has_laptop = BooleanField()
gk = AwesomeGeek(name='John', has_laptop=True).save()
class DynamicGeek(DynamicDocument):
meta = {'collection': 'geek'}
DynamicGeek.objects.first() # raises mongoengine.errors.FieldDoesNotExist
#The field 'has_laptop' does not exist on the document
# Geek.AwesomeGeek
DynamicGeek.objects.exclude('_cls').first() # works great