-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
MongoDB IndexOptions type is missing #10590
Comments
are you sure about that? because since 4.x mongodb provides official types, making the |
Yes, I am. A few seconds after installing it, the error was gone. Also, the VSCode navigation breadcrumbs for the (fixed) interface is |
mongodb 4.x is only supported from / since mongoose 6.0
so what version of |
Since the error is gone, I'll close this for now. |
Version |
@vkarpov15 It's gone, but was manually fixed. Shouldn't it be fixed for everyone else? |
@rlawisch in your provided example, if you try to |
@hasezoey yes, my bad, haven't seen this. |
I'm facing this issue on mongoose
When I go to definition of
When go to definition of
I get the message "No definition found for IndexOptions" when I click "Go to definition" for
|
you either dont have |
By an earlier version do you mean earlier version of mongoose?
|
no i by an earlier version i mean of |
@tehmas could you maybe provide output of |
@hasezoey output of
|
then this is weird, because i cannot get it to re-produce that error, because
|
i can see the error in stackblitz (even after upgrading to latest 5.13), but i cannot see the reason why and i cannot reproduce it locally |
My fix was to put this in my package.json: "resolutions": {
"@types/mongodb": "3.6.20"
} Figured out that some other package was also depending on v4 types, which were apparently not compatible with my mongoose version v5.9. This fix probably also works with slightly different mongoose and mongodb versions, but those are the ones I used |
I see the StackBlitz IDE showing a warning, but the project compiles fine, both locally and on StackBlitz. The following screenshot shows that I've made some edits and StackBlitz accepts them. I'm going to chalk this up as a quirk of StackBlitz's IDE, since it looks like this project compiles fine on StackBlitz. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior? If the current behavior is a bug, please provide the steps to reproduce.
In
Schema.index
second parameter,{ unique: true }
was marked as invalid becauseunique
is not a member of Mongoose'sIndexOption
interface.EDIT: See it on StackBlitz
The Mongoose's interface extends MongoDB's
IndexOptions
interface, which was not available in@types/mongodb
version3.6.20
resolved as a Mongoose dependency by NPM.Manually installing an updated package (version
4.0.7
) fixed the error.What is the expected behavior?
Using
unique
and other index options should be TS-compilable.What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
14.17.3
5.13.7
4.1.0
4.3.5
The text was updated successfully, but these errors were encountered: