-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Unreported breaking change - insertMany with lean option #14698
Closed
2 tasks done
Labels
new feature
This change adds new functionality, like a new method or class
Milestone
Comments
IslandRhythms
added
discussion
If you have any thoughts or comments on this issue, please share them!
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
and removed
discussion
If you have any thoughts or comments on this issue, please share them!
labels
Jul 2, 2024
That's a good point, we will add this to our docs. As a workaround, you can use await MyModel.insertMany(docs.map(doc => MyModel.applyDefaults(doc)), { lean: true }) |
vkarpov15
added a commit
that referenced
this issue
Jul 4, 2024
docs(model): note that `insertMany()` with `lean` skips applying defaults
Note: This seems to have appeared in the 7.x branch as well - presumably with 7.6.10 |
This was referenced Aug 30, 2024
This was referenced Sep 3, 2024
This behavior is still present in version 8.7.0. It's not just the default values but also timestamps. |
vkarpov15
removed
the
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
label
Oct 6, 2024
vkarpov15
added
the
new feature
This change adds new functionality, like a new method or class
label
Oct 8, 2024
vkarpov15
added a commit
that referenced
this issue
Oct 8, 2024
…tamps, including subdocuments, to a given POJO Fix #14698
vkarpov15
added a commit
that referenced
this issue
Oct 9, 2024
vkarpov15
added a commit
that referenced
this issue
Oct 13, 2024
feat(model): add applyTimestamps() function to apply all schema timestamps, including subdocuments, to a given POJO
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Issue
When this issue was raised: #14372
The fix was to skip hydration in "insertMany" - this causes a bug where insertMany suddenly does't take care for "defaults"
I think it should be mention somewhere, just wanted to point it out 🙏
Thank you very much for your work !
The text was updated successfully, but these errors were encountered: