MongoEngine / MongoEngine/mongoengine
add parameter `field_name` to in_bulk queryset method
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
the django ORM has a similar function to the existing in_bulk method.
https://docs.djangoproject.com/en/3.2/ref/models/querysets/#in-bulk
It also provides an additional field_name parameter, which makes it easy to load objects in bulk not only by their IDs, but also, by any field. For example, someone might want to bulk load users by their usernames.
It would be convenient if mongoengine also provided the same feature.
What do you think of this idea? I'd love to make a PR if you're okay with this.
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
Start by reading mongoengine/queryset/base.py around the in_bulk implementation referenced in the issue, then compare it with Django's in_bulk documentation and the linked MongoEngine example. Add support for an optional field_name so bulk loading can use fields such as usernames as well as IDs, and verify the existing ID behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100