Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2181

Refactor host/port uri generation

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.11
    • Affects Version/s: None
    • Component/s: mongo-tools-common
    • None

      Tools need to generate a URI from various host/port combinations:

      noformat
      --host foo # single host
      --host foo --port 27017 # single host and port
      --host foo,bar # multiple host
      --host foo,bar --port 27107 # multiple host plus port
      --host foo:27017,bar:27107 # multiple host/port pair (but maybe invalid without repl set name?)

      1. For all the above, host can be prefixed with a replica set name

      --host setname/foo,bar --port 27107

      1. It's also possible to specify a port by itself

      --port 33333

      
      

      Logic to handle this is scattered, including:

      • options/options.go (ParseArgs)
      • db/db.go (configureClient)
      • helpers in util/mongo.go

      These should all be centralized and rationalized to convert any host/port combination into the expected URI and there should be unit testing for the conversions.

            Assignee:
            Unassigned Unassigned
            Reporter:
            david.golden@mongodb.com David Golden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: