Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1685

Interface to connect to database from uri with default database name

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.8
    • Affects Version/s: None
    • Component/s: 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@mongodb.com Bernie Hackett
            Reporter:
            jaraco Jason R. Coombs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: