MongoEngine / MongoEngine/mongoengine
Modifying document without uploading to the database
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
Is there a way to update a document without uploading it to the database?
The ultimate goal is to perform validation before uploading to the database (see #1984 and #1287).
I would like to do something like this:
document.modify(upload_to_db=False, **update) # or .upload()
document.validate()
document.save()
# or
document.modify(upload_to_db=False, **update) # or .upload()
document.save(validate=True)
How to get the updated document without upload?
Recreating the new document is very painful while supporting the "Django-style update keyword arguments".
The only solution I have so far is to call modify() to get the new document, validate the document, re-upload the old document if the validation fails.
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 tracing the existing Document.modify and Document.save behavior, then read the related issues #1984 and #1287 for prior discussion. Done should provide a supported way to apply Django-style update keyword arguments, validate the resulting document before database upload, and preserve the existing save behavior.
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
- Mostly clear
- Newbie friendliness
- 25/100