我的模型:
class City(EmbeddedDocument):
name = StringField()
population = IntField()
class Privince(EmbeddedDocument):
name = StringField()
cities = ListField(EmbeddedDocumentField(City))
class State(Document):
name = StringField()
provinces = ListField(EmbeddedDocumentField(Privince))
我可以Province
使用以下代码删除状态:
State.objects(name="Alaska").update_one(pull__provinces={"name": "Juneau"})
但我不知道如何删除 a 的城市province
。