Details
-
Bug
-
Status: Closed
-
Critical - P2
-
Resolution: Duplicate
-
3.4.11
-
None
-
None
-
ALL
-
(copied to CRM)
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
- duplicates
-
SERVER-31437 Fix parsing of `mongo host/db` connect string
-
- Closed
-
- related to
-
SERVER-29921 Mongo connection uri doesn't support @ character in database name
-
- Closed
-