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

Configure Database Name From Mongo URI

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 1.0.0
    • Fix Version/s: None
    • Component/s: Connections
    • Security Level: Public
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: