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

Incorrect return type in Typescript for doc.deleteOne() in v8 #14081

Closed
2 tasks done
asvendby opened this issue Nov 15, 2023 · 0 comments · Fixed by #14110
Closed
2 tasks done

Incorrect return type in Typescript for doc.deleteOne() in v8 #14081

asvendby opened this issue Nov 15, 2023 · 0 comments · Fixed by #14110
Labels
typescript Types or Types-test related issue / Pull Request
Milestone

Comments

@asvendby
Copy link

asvendby commented Nov 15, 2023

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.0.0

Node.js version

20.9.0

MongoDB server version

6.2.0

Typescript version (if applicable)

5.2.2

Description

v8 of Mongoose changed doc.deleteOne() to return a query instead of the deleted document (see migration guide).

However, the Typescript types seem to not have been updated as they still indicate that the document is returned.

Steps to Reproduce

  1. Install Mongoose v8.0.0
  2. Inspect the return type for deleteOne

Expected Behavior

Expect the Typescript return type to be Promise<DeleteResult> instead of Promise<this>

@vkarpov15 vkarpov15 added this to the 8.0.2 milestone Nov 20, 2023
@vkarpov15 vkarpov15 added the typescript Types or Types-test related issue / Pull Request label Nov 20, 2023
vkarpov15 added a commit that referenced this issue Nov 22, 2023
vkarpov15 added a commit that referenced this issue Nov 22, 2023
types(document): correct return type for `doc.deleteOne()` re: Mongoose 8 breaking change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript Types or Types-test related issue / Pull Request
Projects
None yet
2 participants