MongoEngine / MongoEngine/mongoengine
Sparse false when unique_with
Open
Nobody has claimed this yet.
Documentation
Index
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
I'm trying to create a field like this:
unique_for_owner = fields.StringField(unique_with=["owner"], required=False, sparse=True).
But i notice that index was created with sparse=False.
I dropped my collection and made a few tests, so i notice that when unique_with has a value the sparse always getting False.
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
Trace MongoEngine's field and index creation paths for a Python field using unique_with and sparse=True. Reproduce the reported case against MongoDB and compare the generated index options. Done means unique_with preserves sparse=True in the created index, with a regression test covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100