mongoengine
mongoengine copied to clipboard
Modifying document without uploading to the database
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.
I think this feature should be implemented in mongoengine