3
設置我的模型MongoEngine,並嘗試進行查詢(我已經在我的收藏幾十個文件),但查詢集是空的:MongoEngine沒有看到預先存在的記錄
>>> mymodel.objects
[]
我可以添加新的文件,以及那些出現在隨後的查詢,但有我的已經存在的文件的跡象:
>>> thingy = mymodel(a=2, b=3)
>>> thingy.save()
>>> mymodel.objects
[<mymodel: mymodel object>]
是怎麼回事?作爲參考,這是我的模型定義:
from django.conf import settings
from mongoengine import *
connect(settings.MONGO_DATABASE,
host=settings.MONGO_HOST, port=settings.MONGO_PORT)
class metadata(Document):
meta = {'collection': 'metadata'}
_id = StringField()
name = StringField()
_type = StringField()
terms = ListField()
level = StringField()
abbreviation = StringField()
latest_update = DateTimeField()
feature_flags = ListField()
session_details = DictField()
legislature_name = StringField()
lower_chamber_name = StringField()
upper_chamber_term = IntField()
upper_chamber_name = StringField()
lower_chamber_term = IntField()
lower_chamber_title = StringField()
upper_chamber_title = StringField()
_ignored_scraped_sessions = ListField()
如果這個問題得到由MongoEngine自己的作者說,我想提前來表達,你是真棒!