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

feat(model): add applyTimestamps() function to apply all schema timestamps, including subdocuments, to a given POJO #14943

Merged
merged 4 commits into from
Oct 13, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #14698

Summary

While we won't automatically apply timestamps to Model.insertMany(docs, { lean: true }) anymore re: #14698 (comment), we can at least make it easy to do await MyModel.insertMany(docs.map(doc => MyModel.applyTimestamps(doc)), { lean: true })

Examples

…tamps, including subdocuments, to a given POJO

Fix #14698
@vkarpov15 vkarpov15 added this to the 8.8 milestone Oct 8, 2024
@vkarpov15 vkarpov15 changed the base branch from master to 8.8 October 8, 2024 18:27
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 doc suggestions

lib/helpers/document/applyTimestamps.js Outdated Show resolved Hide resolved
lib/model.js Outdated Show resolved Hide resolved
test/model.test.js Show resolved Hide resolved
@vkarpov15 vkarpov15 merged commit 84fe02c into 8.8 Oct 13, 2024
61 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-14698-2 branch October 13, 2024 10:46
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.

Unreported breaking change - insertMany with lean option
2 participants