Skip to content

Commit

Permalink
pymongo 3 compatibility fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul committed Apr 13, 2016
1 parent 26f5aef commit 7ef9192
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mongoctl/objects/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def get_db(self, dbname, no_auth=False, username=None, password=None,
# if we have the system user then always auth with it
if local_user and users.is_system_user(local_user["username"]) and dbname != "local":
local_db = self.get_db("local", retry=retry)
return local_db.connection[dbname]
return local_db.client.get_database(dbname)

is_system_user = (login_user and
users.is_system_user(login_user.get("username")))
Expand All @@ -562,7 +562,7 @@ def get_db(self, dbname, no_auth=False, username=None, password=None,
not self.supports_local_users())):
# if this passes then we are authed!
admin_db = self.get_db("admin", retry=retry)
return admin_db.connection[dbname]
return admin_db.client.get_database(dbname)

# no retries on local db, so if we fail to auth to local we always
# attempt to use admin
Expand All @@ -575,7 +575,7 @@ def get_db(self, dbname, no_auth=False, username=None, password=None,
not auth_success
and dbname != "admin"):
admin_db = self.get_db("admin", retry=retry)
return admin_db.connection[dbname]
return admin_db.client.get_database(dbname)

if auth_success:
return db
Expand Down

0 comments on commit 7ef9192

Please sign in to comment.