Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33059

Shell no longer accepts legacy connection strings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Duplicate
    • 3.4.11
    • None
    • Shell
    • None
    • ALL

    Description

      The MongoDB 3.4.11 shell broke the "legacy" style host[:port]/dbname connection string format.

      3.4.11

      $ mongo localhost/admin
      MongoDB shell version v3.4.11
      connecting to: mongodb://admin:27017/localhost
      2018-02-01T14:16:28.467-0600 I NETWORK  [thread1] getaddrinfo("admin") failed: nodename nor servname provided, or not known
      2018-02-01T14:16:28.467-0600 E QUERY    [thread1] Error: couldn't initialize connection to host admin, address is invalid :
      connect@src/mongo/shell/mongo.js:240:13
      @(connect):1:6
      exception: connect failed
      

      There are two workarounds for this issue:

      • Use a 3.4.10 shell:

        $ mongo localhost/admin
        MongoDB shell version v3.4.10
        connecting to: mongodb://localhost/admin
        MongoDB server version: 3.4.11
        >
        

      • Use the --host <host> <database> syntax:

        $ mongo --host localhost admin
        MongoDB shell version v3.4.11
        connecting to: mongodb://localhost:27017/admin
        MongoDB server version: 3.4.11
        >
        

      The documentation and --help parameters both show this as a valid connection string.

      mongo --help
      MongoDB shell version v3.4.11
      usage: mongo [options] [db address] [file names (ending in .js)]
      db address can be:
        foo                   foo database on local machine
        192.168.0.5/foo       foo database on 192.168.0.5 machine
      

      Attachments

        Issue Links

          Activity

            People

              sara.golemon@mongodb.com Sara Golemon
              kevin.arhelger@mongodb.com Kevin Arhelger
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: