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

Query.count / Query.findOneAndRemove are still alive #14689

Closed
2 tasks done
DevooKim opened this issue Jun 25, 2024 · 0 comments · Fixed by #14692
Closed
2 tasks done

Query.count / Query.findOneAndRemove are still alive #14689

DevooKim opened this issue Jun 25, 2024 · 0 comments · Fixed by #14692
Milestone

Comments

@DevooKim
Copy link
Contributor

DevooKim commented Jun 25, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.4.3

Node.js version

20.14

MongoDB server version

7.0

Typescript version (if applicable)

No response

Description

Query.prototype.count() and findOneAndRemove() are still alive.

I found that the issue was that the query was using mquery as it is. - permlink
mquery@5 has count() and findOneAndRemove().

Therefore, mongoose@8 removed count() and findOneAndRemove(), but the methods from mquery are being called.

Steps to Reproduce

await User.updateOne().findOne().findOneAndRemove();
await User.findOne().count();

I don't think this is good code, but it still works.

Expected Behavior

No response

vkarpov15 added a commit that referenced this issue Jul 1, 2024
fix(query): remove `count()` and `findOneAndRemove()` from query chaining
@vkarpov15 vkarpov15 added this to the 8.5 milestone Jul 3, 2024
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 a pull request may close this issue.

2 participants