Interface to connect to database from uri with default database name

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.8
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In PYTHON-461 and PYTHON-1305, some work has been done to provide for nicer handling of soliciting the database name from the URI, but one common use-case is still missing: the ability for the application to provide a default database name but for the user of the application to supply a URI superseding that name.

      This need is illustrated in this helper function.

      At one point, I thought that MongoClient(uri).get_database(default) would work, but it doesn't because that usage assumes that the supplied name supersedes the name in the URI.

      It would be nice if the interface could allow the programmer to supply a default and for the user to override that default (without having to dance around the interface like this helper function does).

      *Edit: fixed link.

            Assignee:
            Bernie Hackett
            Reporter:
            Jason R. Coombs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: