mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Save with cascade=True fix for unsaved child documents

Open nickfrev opened this issue 4 years ago • 1 comments

A fix for https://github.com/MongoEngine/mongoengine/issues/1236

Moved the cascade save portion of the Document.save method above the validation check. This does mean that there is a possibility that a child document could be saved while the parent document is not valid for another reason but this would already occur anyway with the current work arounds to this issue.

This move also removed this code block from the try-catch statement however all errors should be being caught by Document.cascade_save anyway.

nickfrev avatar Dec 14 '21 18:12 nickfrev

This Pull request is a subset of a larger pull request which include more issue fixes and features: https://github.com/MongoEngine/mongoengine/pull/2615 If that pull request gets approved this one will be closed.

nickfrev avatar Jan 07 '22 18:01 nickfrev