#NEWLINE# def mongo_dump_uri( uri , username = None , password = None , use_best_secondary = False , dump_options = None ) : #NEWLINE# #INDENT# uri_wrapper = parse_mongo_uri ( uri ) #NEWLINE# database = uri_wrapper . database #NEWLINE# username = ( username if username else uri_wrapper . username ) #NEWLINE# password = ( password if password else uri_wrapper . password ) #NEWLINE# server_or_cluster = repository . build_server_or_cluster_from_uri ( uri ) #NEWLINE# if isinstance ( server_or_cluster , Server ) : #NEWLINE# #INDENT# mongo_dump_server ( server_or_cluster , database = database , username = username , password = password , dump_options = dump_options ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mongo_dump_cluster ( server_or_cluster , database = database , username = username , password = password , use_best_secondary = use_best_secondary , dump_options = dump_options )