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
findByIdAndDelete should not be typed as returning ModifyResult #14233
Comments
Looks like this was fixed in #14196, I can repro with 8.0.3 but not master using the following script:
|
Great, waiting for the next patch then, thank you 🙏🏼 |
I see a new |
@cbnsndwch You could try to temporarily solve this issue by using Otherwise you can just use findOneAndDelete instead, which seems to be properly typed. |
@lmarinborges thanks for the suggestion! The types in Mongoose are a not trivial to detangle and I have just three places in my app where this creates an issue so I just The long term solution for us is likely migrating to Nest 10 and Mongoose v8 anyway, so this will serve as yet another incentive 😅 |
@cbnsndwch this fix is only in 8.0.4, not on 7.6.8 currently. We will backport. |
@vkarpov15 thank you for the reply! I've started migrating my projects to Nest 10.x and Mongoose 8.x now, so I'm halfway GTG. Glad to hear you're backporting the fix though, thanks 🙏! |
Prerequisites
Mongoose version
8.0.3
Node.js version
20.9.0
MongoDB server version
6.0.12
Typescript version (if applicable)
5.3.3
Description
findByIdAndDelete
is still defined in TypeScript as returningModifyResult
; unlikefindOneAndDelete
, which is properly typed as returning the deleted document (#14153).Steps to Reproduce
Expected Behavior
findByIdAndDelete
should not returnModifyResult
.The text was updated successfully, but these errors were encountered: