Skip to content

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

Merged
vkarpov15 merged 4 commits into8.8from
vkarpov15/gh-14698-2
Oct 13, 2024
Merged

feat(model): add applyTimestamps() function to apply all schema timestamps, including subdocuments, to a given POJO#14943
vkarpov15 merged 4 commits into8.8from
vkarpov15/gh-14698-2

Conversation

@vkarpov15
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread lib/helpers/document/applyTimestamps.js Outdated
Comment thread lib/model.js Outdated
Comment thread test/model.test.js
@vkarpov15 vkarpov15 merged commit 84fe02c into 8.8 Oct 13, 2024
@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