Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mongodbtools/redundant_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ def get_cli_options():

return options

def get_connection(host, port, username, password):
def get_connection(host, port, database, username, password):
userPass = ""
if username and password:
userPass = username + ":" + password + "@"

mongoURI = "mongodb://" + userPass + host + ":" + str(port)
mongoURI = "mongodb://" + userPass + host + ":" + str(port) + '/' + database
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still work if not database is specified?

return Connection(host=mongoURI, read_preference=ReadPreference.SECONDARY)

def main(options):
connection = get_connection(options.host, options.port, options.user, options.password)
connection = get_connection(options.host, options.port, options.database, options.user, options.password)

def compute_signature(index):
signature = index["ns"]
Expand Down