我使用的是mongoengine 0.9.0
class EntityChange(Document):
...
old_data = DictField()
new_data = DictField()
我想将dict
个对象保存到old_data
和new_data
。
为什么分配后字段会变为BaseList
?
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?
答案 0 :(得分:2)