Skip to content
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

fix(model): throw MongooseBulkSaveIncompleteError if bulkSave() didn't completely succeed #14884

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #14763

Summary

Make it so that bulkSave() throws an error if not all documents were successfully updated due to version errors or optimistic concurrency. I thought more about #14763 and this seems like the way to go: if not all documents were updated, we don't know which documents we can run post save hooks on, or which documents to update $isNew on.

Examples

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor jsdoc suggestion and the error should likely be added to the types too

lib/error/bulkSaveIncompleteError.js Show resolved Hide resolved
@vkarpov15 vkarpov15 merged commit 45bb194 into 8.7 Sep 19, 2024
46 checks passed
@vkarpov15 vkarpov15 added this to the 8.7 milestone Sep 19, 2024
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-14763-2 branch September 19, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants