如何使用mongoengine
更新嵌套嵌入式文档的值,这是我的架构:
class Stories(db.Document):
id = db.ObjectIdField(primary_key=True)
name = db.StringField(required=True, unique=True)
story_knowledges = db.ListField(db.EmbeddedDocumentField(StoryKnowledges))
class StoryKnowledges(db.EmbeddedDocument):
id = db.ObjectIdField(primary_key=True)
params = db.ListField(db.EmbeddedDocumentField(Params))
class Params(db.EmbeddedDocument):
id = db.ObjectIdField(primary_key=True)
name = db.StringField(required=True)
如何使用StoryKnowledges
有效更新Params文档或更新mongoengine
文档。