Connecting to Replica Set - Chapter 4 Lab

The answer incorrectly mentions that you can connect to the replica set using the command mongo --host m312rs/m312 --port 30000, but it results in this error when running it in the course’s vagrant environment:

vagrant@m312:~$ mongo --host m312rs/m312 --port 30000
MongoDB shell version v3.4.2
connecting to: mongodb://m312rs/m312:30000/
2021-08-24T17:34:16.123+0000 E QUERY    [thread1] Error: Failed to parse mongodb:// URL: mongodb://m312rs/m312:30000/ :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

The command I used was mongo --host m312rs/m312:30000, which works.

2 Likes