Skip to content

Commit 9e7f995

Browse files
mongodb.py: updated dbname() for new mongo API and renamed to fullname()
1 parent 1598073 commit 9e7f995

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tools/mongodb.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,12 @@ def wrapper(*args, **kwargs):
7575
return wrapper
7676
return decorator
7777

78-
def dbname(db_):
78+
def fullname(db_):
7979
'''return host, port, database, and collection name of db'''
80-
host = db_._Collection__database._Database__connection.host
81-
port = db_._Collection__database._Database__connection.port
82-
database = db_._Collection__database._Database__name
83-
collection = db_.name
84-
return '%s:%d/%s.%s' % (host, port, database, collection)
80+
host_ = db_.database.connection.host
81+
port_ = db_.database.connection.port
82+
fullname = db_.full_name
83+
return '%s:%s/%s' % (host_, port_, fullname)
8584

8685
def file2collection(file):
8786
'''sanitize a filename to use as a collection'''

0 commit comments

Comments
 (0)