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

Update for MongoDB 4 #18

Closed
Mahan-F opened this issue May 17, 2022 · 3 comments
Closed

Update for MongoDB 4 #18

Mahan-F opened this issue May 17, 2022 · 3 comments

Comments

@Mahan-F
Copy link

Mahan-F commented May 17, 2022

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
@lamualfa
Copy link
Owner

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

@Mahan-F
Copy link
Author

Mahan-F commented May 19, 2022

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.

@lamualfa
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants