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

pymongo >= 3.5: authentication changes #1062

Closed
ghost opened this issue Aug 9, 2017 · 4 comments
Closed

pymongo >= 3.5: authentication changes #1062

ghost opened this issue Aug 9, 2017 · 4 comments
Labels
bug Indicates an unexpected problem or unintended behavior component: bots
Milestone

Comments

@ghost
Copy link

ghost commented Aug 9, 2017

Excerpt from changelog of newly released pymongo version 3.5:

  • Username and password can be passed to
    :class:~pymongo.mongo_client.MongoClient as keyword arguments. Before, the
    only way to pass them was in the URI.

And:

Deprecated :meth:~pymongo.database.Database.authenticate. Authenticating multiple users conflicts with support for logical sessions in MongoDB 3.6. To authenticate as multiple users, create multiple instances of :class:~pymongo.mongo_client.MongoClient.

We are currently using this method for authentication. I suggest to use the new authentication for newer versions of pymongo and use the newer for anything >= 3.5. with pymongo 3.6 this needs to be done, otherwise the bot will be broken.

FYI @vince-nayal and @CNCS-PT (authors of the bot)

@ghost ghost added the component: bots label Aug 9, 2017
@ghost ghost added this to the 1.1.0 milestone Aug 9, 2017
@ghost
Copy link
Author

ghost commented Dec 6, 2017

And further in version 3.6:

Unavoidable breaking changes:

Starting in MongoDB 3.6, the deprecated methods :meth:~pymongo.database.Database.authenticate and :meth:~pymongo.database.Database.logout now invalidate all cursors created prior. Instead of using these methods to change credentials, pass credentials for one user to the :class:~pymongo.mongo_client.MongoClient at construction time, and either grant access to several databases to one user account, or use a distinct client object for each user.

I am not sure if that has an impact on how we use these methods.

@vince-nayal
Copy link
Contributor

Hi,

Sorry, i missed the first notification.

Since I never had to deal with such situation, I am not sure how to do this, do we have to break backward compatibility or is there a way to preserve both methods ?

@ghost
Copy link
Author

ghost commented Dec 11, 2017

@vince-nayal
Using pymongo.version you can differentiate between the versions. I.e. do pymongo.version.split('.') < ['3', '5']

@ghost ghost mentioned this issue Dec 12, 2017
@ghost ghost modified the milestones: 1.1.0, 1.2.0 Jun 28, 2018
@ghost ghost modified the milestones: 1.2.0, 2.0.0 Apr 9, 2019
@ghost ghost added the bug Indicates an unexpected problem or unintended behavior label Apr 10, 2019
@ghost ghost modified the milestones: 2.0.0, 2.0.1 May 19, 2019
@ghost ghost self-assigned this Aug 1, 2019
@ghost ghost closed this as completed in 5b5d473 Aug 1, 2019
@ghost
Copy link
Author

ghost commented Aug 1, 2019

I fixed this now based on the documentation. If you have time, maybe you can test it?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior component: bots
Projects
None yet
Development

No branches or pull requests

1 participant