lamualfa/i18next-node-mongodb-backend-next

Update for MongoDB 4

Mahan-F opened this issue · 3 comments

Hi, is it possible to get this package updated so that it can be used with the latest version of MongoDB?

Currently it will break because client.isConnected() is no longer a thing in version 4. (Details here)

The changelog mentions

Remove MongoClient.isConnected - calling connect is a no-op if already connected

I've been releasing v1.0.0 of this package. Glad to see your feedback on this package. Thanks.

Thanks a lot for this, I just had a look at the changes you made and I noticed two things that seem to be not inline with Mongodb 4 changes.

From what I understand, client.isConnected has been completely removed and you just call client.connect() at all times, if there is already a connection, it will do nothing.

 
 ​    ​if​ ​(!client.isConnected​ ​||​ ​!client.isConnected())​ ​{ 
 ​      ​await​ ​client.connect(); 
 ​    ​}

Also on line 118, you are setting user property but this has been changed to username in the latest version.

From what I understand, client.isConnected has been completely removed and you just call client.connect() at all times, if there is already a connection, it will do nothing.

Don't worry, I just want to give support for the older and newer version of mongodb sdk.

From what I understand, client.isConnected has been completely removed and you just call client.connect() at all times, if there is already a connection, it will do nothing.

Damn, I missed it up. Ok, I'll publish a new version to fix this problem.