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(query): add overwriteImmutable option to allow updating immutable properties without disabling strict mode #15000

Merged
merged 8 commits into from
Nov 4, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #8619

Summary

#8619 pointed out that we don't have docs in place for how to change a document's createdAt without bypassing Mongoose entirely, and the example in #8619 no longer works now that createdAt is an immutable property. So this PR adds overwriteImmutable property to queries to allow updating immutable properties.

Examples

…le properties without disabling strict mode

Fix #8619
@vkarpov15 vkarpov15 added this to the 8.8.1 milestone Nov 1, 2024
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.

One slight docs typo, otherwise suggestions.

docs/timestamps.md Outdated Show resolved Hide resolved
docs/timestamps.md Outdated Show resolved Hide resolved
lib/helpers/query/handleImmutable.js Show resolved Hide resolved
lib/query.js Outdated Show resolved Hide resolved
lib/query.js Outdated Show resolved Hide resolved
lib/query.js Outdated Show resolved Hide resolved
@hasezoey hasezoey added the enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature label Nov 3, 2024
vkarpov15 and others added 6 commits November 4, 2024 13:47
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
@vkarpov15 vkarpov15 merged commit 2eab0cd into master Nov 4, 2024
65 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-8619 branch November 5, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mongoose update method cannot change createdAt field
2 participants