Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-914

Configure Database Name From Mongo URI

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.0.0
    • Component/s: Connections
    • None

      When using `ClientOptions.ApplyURI` the Database is extracted from the uri inside the `parser.parse` method in `connstring.go`,  but is then not set on `ClientOptions` (in fact this struct does not have a `Database` parameter) and is not passed through to the `Client` at all.

       

      Coming from `globalsign/mgo` - we are using `session.DB("")` to allow use of the `defaultDb` inside `session.go` and I would like to see this or something similar implemented for your driver in the `Client.Database` method, as our database name is environment specific and it is far simpler for us to set this value in the mongo uri (one place) than to set it at an application level per environment.

       

      I am happy to create a PR to cover this feature and collaborate on this feature going forward, as we are very keen to migrate our applications away from mgo to the official driver, and this small fix would save a lot of configuration overhead for us.

            Assignee:
            scott.lhommedieu@mongodb.com Scott L'Hommedieu (Inactive)
            Reporter:
            Rossiar Ross Henderson [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: