Closed frank-mendez closed 1 month ago
Can you please provide what your package.json
dependencies look like? This issue looks like it may be due to having multiple incompatible versions of the MongoDB Node driver installed: the error message indicates that you're trying to assign node_modules/mongoose/node_modules/mongodb
's version of ChangeStreamOptions
to a variable that expects node_modules/mongodb
's version of ChangeStreamOptions
. Likely because you have a top-level dependency on "mongoose" and "mongodb", and your version of "mongodb" is different from mongoose's
I'm using mongoose: 10.06
and NestJS Mongoose @nestjs/mongoose: 10.0.6
Also for my docker environment I'm using
mongo: 6.0.4
@vkarpov15 Thank you for taking a look. I'll also review the dependencies within the NestJS ecosystem. Currently, my API is functioning properly. For now, I've added some //ts-ignore comments.
Can you please run npm list mongodb
and paste the output in a comment? That should help determine where the duplicate mongodb dep is coming from.
Ah ok, it looks like you're using a version of typeorm that pulls in a different version of MongoDB. Weirdly enough, typeorm seems to only support MongoDB driver 5.x, even though their devDependencies use mongodb driver 6.x for testing :confused:
You should be able to override typeorm to use mongodb@6, I'll try this out.
Yeah I tried this out and you can do the following in package.json
:
{
"dependencies": {
"mongoose": "8.4.4",
"typeorm": "0.3.20"
},
"overrides":{
"mongodb": "6.6.2"
}
}
Just make sure your "mongodb" override lines up with Mongoose's version of mongodb.
Prerequisites
Mongoose version
8.4.4
Node.js version
21.6.2
MongoDB server version
6.0.4
Typescript version (if applicable)
5.1.3
Description
Steps to Reproduce
Create a class
EventsBridge
implementsOnApplicationBootstrap
andOnApplicationShutdown
create a private variableprivate changeStream: ChangeStream;
Expected Behavior
Should not expect not missing
MongoOptions
Type MongoOptions is missing the following properties from type MongoOptions:keepAlive
,keepAliveInitialDelay