MongoEngine / MongoEngine/mongoengine
Indexes for embedded documents
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
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))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by tracing the existing index creation logic for embedded documents and how EmbeddedDocument meta indexes are read. Done means an embedded document's meta indexes are applied to the containing document's embedded fields, including the example's comments.type and comments.author indexes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100