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

mongo cli --host argument regression from 3.2 to 3.4

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.7
    • Component/s: Shell, Tools
    • Environment:
      CentOS release 6.7 (Final)
    • Fully Compatible
    • ALL
    • 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

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

            Assignee:
            sara.golemon@mongodb.com Sara Golemon
            Reporter:
            aqueen Aaron Queen
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: