-
Notifications
You must be signed in to change notification settings - Fork 1.2k
cascade_save does not save new referenced document #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cascade_save does not save new referenced document #1236
Comments
I have the same problem. |
Hi. Any news on this ? It seems like the bug is still there. |
Get the same behaviour here with MongoEngine 0.11.0.
|
I have the same problem reported here, save(cascade=True) doesn't work and thus saving the parent document throws a ValidationError. |
Same issue here. |
+1 bumping this, it would be great to be able to save new embedded documents as references without having to dig into the substructure of the parent document to save all the new objects. |
+1 bumping this. How is this still open after four years? |
+1 |
+1 once again. Having to override the def save(self, *args, **kwargs):
for ref in self.refs.values():
ref.save()
return super().save(*args, **kwargs) |
+1 |
2 similar comments
+1 |
+1 |
Save the children documents first to avoid the issue where a parent cannot save due to having new children documents.
Is this Issue solved? |
Is this solved? |
When saving a document with a
ReferenceField
holding a new object, I get an error:I naively expected
cascade=True
to automatically save the new document, while apparently it only automatically saves changes to existing documents.Is this something that could be changed or is it meant to be for good reasons?
Example:
I'd like this not to throw
ValidationError
but to saveu1
in cascade.The text was updated successfully, but these errors were encountered: