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

Add support for findOneAndReplace #34

Merged
merged 2 commits into from
Apr 27, 2024
Merged

Conversation

Ebulus7899
Copy link

@Ebulus7899 Ebulus7899 commented Apr 23, 2024

findOneAndReplace is currently not supported. This is required since a change in mongoose (commit 0caeb6b2e8428cb56573b75212ddb7c186c2725d) swapped findOneAndUpdate with the overwrite option set to use findOneAndReplace which is not supported by mongoose-lean-getters.

Summary

When you use the overwrite option with findOneAndUpdate / findOneAndReplace the getters will not be applied to the schema.

Examples

We have a findOneAndReplace call with lean({getters: true}) specified. We have fields we want to convert from an objectId back to a string however the transfor is not applied.

findOneAndReplace is currently not supported. This is required since
a change in mongoose (commit 0caeb6b2e8428cb56573b75212ddb7c186c2725d)
swapped findOneAndUpdate with the overwrite option set to use
findOneAndReplace which is not supported by mongoose-lean-getters.
@vkarpov15 vkarpov15 merged commit a1dcb4a into mongoosejs:master Apr 27, 2024
3 checks passed
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.

3 participants