Discuss:
Currently MongoEngine design requires explicitly indexes creation at main document. In the example bellow in order to index each Post comments type an index must be created as 'comments.type', the meta part from Comment Class is ignore.
Upgrade the existing logic to support an additional feature that creates indexes for each field based on the Embedded document meta:
class Comment(db.EmbeddedDocument):
comment = db.StringField()
type = db.IntField()
author = db.ReferenceField(User,dbref=False)
meta = {'indexes': ['+author','type']}
class Post(db.Document):
post = db.StringFiled()
comments = db.ListField(db.EmbeddedDocumentField(Comment))
Discuss:
Currently MongoEngine design requires explicitly indexes creation at main document. In the example bellow in order to index each Post comments type an index must be created as 'comments.type', the meta part from Comment Class is ignore.
Upgrade the existing logic to support an additional feature that creates indexes for each field based on the Embedded document meta: