I'm using mongoengine 0.9.0
class EntityChange(Document):
...
old_data = DictField()
new_data = DictField()
I want to save dict
objects into old_data
and new_data
.
Why are fields becoming BaseList
after assignment?
data = {u'int_id': 100500, u'_cls': 'BuildingKind', ...}
instance = EntityChange()
instance.new_data = data
# after that
# isinstance(instance, BaseList) is True
# isinstance(instance, BaseDict) is False
# instance.new_data == ['int_id', 'id', ...] is True. why?
Passing a dict
containing _cls
or _types
triggered a bug in mongoengine.
A fix has been submitted and was merged in versions 0.10.1 and later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With