我有文档和嵌入文档。我想在EmbeddedDocument的字段上创建一个索引。 下面是示例结构和我尝试过的内容。你知道吗
from mongoengine import Document, EmbeddedDocument, fields
class Parent(Document):
meta = {
'collection': 'parent',
'indexes': [
'name',
'child__name', # throws mongoengine.errors.LookUpError: Cannot resolve field "child__name"
'child.name', # does nothing
],
}
name = fields.StringField()
child = fields.EmbeddedDocumentField(Child)
class Child(EmbeddedDocument):
meta = {
'indexes': [
'name', # does nothing
],
}
name = fields.StringField()
这甚至可以创建这样的索引吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐