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

mongo cli --host argument regression from 3.2 to 3.4

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 3.4.7
    • Fix Version/s: None
    • Component/s: Shell, Tools
    • Labels:
    • Environment:
      CentOS release 6.7 (Final)
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      On 3.2.13

      $ mongo --host mongo_cluster1/m1.localhost:27017,m2.localhost:27017 dbname
      MongoDB shell version: 3.2.13
      connecting to: mongo_cluster1/m1.localhost:27017,m2.localhost:27017/dbname
      

      -
      On 3.4.7

      $ mongo --host mongo_cluster1/m1.localhost:27017,m2.localhost:27017 dbname
      MongoDB shell version v3.4.7
      connecting to: mongodb://mongo_cluster1/m1.localhost:27017,m2.localhost:27017/dbname
      2017-09-01T16:25:00.225+0000 E QUERY    [thread1] Error: Failed to parse mongodb:// URL: mongodb://mongo_cluster1/m1.localhost:27017,m2.localhost:27017/dbname :
      connect@src/mongo/shell/mongo.js:237:13
      

      $ mongo dbname --host mongo_cluster1/m1.localhost:27017,m2.localhost:27017
      // same error as above
      

      $ mongo m1.localhost:27017,m2.localhost:27017/dbname
      MongoDB shell version v3.4.7
      connecting to: mongodb://m1.localhost:27017,m2.localhost:27017/dbname
      2017-09-01T16:33:15.244+0000 E QUERY    [thread1] Error: Cannot list multiple servers in URL without 'replicaSet' option :
      connect@src/mongo/shell/mongo.js:237:13
      

      -
      Undocumented workaround #1 on 3.4.7, also works on 3.2.13

      $ mongo mongodb://m1.localhost:27017,m2.localhost:27017/dbname?replicaSet=mongo_cluster1
      MongoDB shell version v3.4.7
      connecting to: mongodb://m1.localhost:27017,m2.localhost:27017/dbname?replicaSet=mongo_cluster1
      

      -
      Undocumented workaround #2 on 3.4.7, errors on 3.2.13

      $ mongo m1.localhost:27017,m2.localhost:27017/dbname?replicaSet=mongo_cluster1
      MongoDB shell version v3.4.7
      connecting to: mongodb://m1.localhost:27017,m2.localhost:27017/dbname?replicaSet=mongo_cluster1
      

      Show
      On 3.2.13 $ mongo --host mongo_cluster1 /m1 .localhost:27017,m2.localhost:27017 dbname MongoDB shell version: 3.2.13 connecting to: mongo_cluster1 /m1 .localhost:27017,m2.localhost:27017 /dbname - On 3.4.7 $ mongo --host mongo_cluster1 /m1 .localhost:27017,m2.localhost:27017 dbname MongoDB shell version v3.4.7 connecting to: mongodb: //mongo_cluster1/m1 .localhost:27017,m2.localhost:27017 /dbname 2017-09-01T16:25:00.225+0000 E QUERY [thread1] Error: Failed to parse mongodb: // URL: mongodb: //mongo_cluster1/m1 .localhost:27017,m2.localhost:27017 /dbname : connect@src /mongo/shell/mongo .js:237:13 $ mongo dbname --host mongo_cluster1 /m1 .localhost:27017,m2.localhost:27017 // same error as above $ mongo m1.localhost:27017,m2.localhost:27017 /dbname MongoDB shell version v3.4.7 connecting to: mongodb: //m1 .localhost:27017,m2.localhost:27017 /dbname 2017-09-01T16:33:15.244+0000 E QUERY [thread1] Error: Cannot list multiple servers in URL without 'replicaSet' option : connect@src /mongo/shell/mongo .js:237:13 - Undocumented workaround #1 on 3.4.7, also works on 3.2.13 $ mongo mongodb: //m1 .localhost:27017,m2.localhost:27017 /dbname ?replicaSet=mongo_cluster1 MongoDB shell version v3.4.7 connecting to: mongodb: //m1 .localhost:27017,m2.localhost:27017 /dbname ?replicaSet=mongo_cluster1 - Undocumented workaround #2 on 3.4.7, errors on 3.2.13 $ mongo m1.localhost:27017,m2.localhost:27017 /dbname ?replicaSet=mongo_cluster1 MongoDB shell version v3.4.7 connecting to: mongodb: //m1 .localhost:27017,m2.localhost:27017 /dbname ?replicaSet=mongo_cluster1

      Description

      When using the --host argument on 3.4.7, you can no longer connect to a replica set while also specifying a database name.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: