Mongoose has no `DocumentToObjectOptions` - nestjs-query
I've been following the guide and then the example, but I always get the following error message:
node_modules/@nestjs-query/query-mongoose/dist/src/services/mongoose-query.service.d.ts:2:20 - error TS2305: Module '"mongoose"' has no exported member 'DocumentToObjectOptions'.
A quick search in the mongoose repository shows that DocumentToObjectOptions
does indeed not exist and never has.
It seems like this is because mongoose 5.11 now uses it's own typings? I have other problems though, when downgrading, so I cannot try this.
Have you read the Contributing Guidelines?
Yes, I have
To Reproduce Steps to reproduce the behavior: 1. Follow the example with mongoose
Expected behavior Successful build.
Desktop (please complete the following information): - Node Version 12.16.0 - Nestjs-query Version 0.21.2
5 Answer:
@tillsanders I've not tried mongoose 5.11 yet, but looking at the issues in their repo this is pretty common with some people removing the mongoose types and installing @types/mongoose
I'll need to try to upgrade to 5.11
in order to see what's going on, as I suspect there is more than just the DocumentToObjectOptions
missing or not working.
FYI and not completely relevant, but Typegoose has frozen their Mongoose version because of the changes in types.
Scott
@tillsanders Altough downgrading seems not to be a viable option for you, I just wanted to share the combination of package versions that apparently works for me (tm):
"dependencies": {
"@nestjs/mongoose": "~7.1.2",
"mongoose": "5.10.0 - 5.10.18"
},
"devDependencies": {
"@types/mongoose": "^5.10.2"
}
@doug-martin is there anything we could help with?
@Perni1984 - 5.10.18 is where Typegoose froze at too. Seems 5.10.19 and higher is where the new types start breaking things.
Scott
@tillsanders the latest version includes support for v5.11.x
! Let me know if you have any issues.
Read next
- baritone Custom Scripts? Java
- Crash - lateinit property initialState has not been initialized - Kotlin LoadingButtonAndroid
- bug(CdkObserveContent): Incorrect typing for CdkObserveContent's [debounce] property - components
- Добавить возможность использовать ЯП Rust для решения. - Elixir codebattle
- Blurriness in FMVs when selecting adaptive downsampling (PAL) - Cplusplus duckstation
- Client configuration for using PCKE? - JavaScript node-oidc-provider
- fatal: pathspec - Filename too long - GIT - woocommerce
- Xsharedpreference Failing to read prefs file above SDK 24 - EdXposed