MongoEngine / MongoEngine/mongoengine
Swapping unique or unique_with values between two documents
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
If I have two documents A and B that each have respective unique values 1 and 2, and I want to swap the values between them, is there a way to do that that doesn't involve (for example):
Save A with unique value 3
Save B with unique value 1
Save A with unique value 2
Essentially I'm asking: is there an easy way to swap the unique values of A and B and save both of those to the database simultaneously?
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
The issue names no files, tests, or entry points. Start by reviewing MongoEngine's unique-field handling and MongoDB update behavior; determine whether two documents can be persisted with swapped unique values atomically, and define the required API or limitation before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100