Chapter 2 Lab 1: Cannot connect to mongo as admin

I have been trying to do step 6 in this lab and mongo will not connect to the primary node. I use the command:

mongo --host “m103-repl/m103.mongodb.university:27001” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”

This results in the system doing this until it gives up:

When I click run test it says that there is a node in the replica set but since I cannot connect to it I cannot add the others.

How do I correctly log in as the admin user I created?

Hi @Alisalee_Aaron,

Here,

mongo --host “m103-repl/m103.mongodb.university:27001” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”

Your command is incorrect. Kindly review it…!!
We will suggest you to re-watch the earlier lecture and read the problem statement carefully.

Thanks,
Kushagra

Hello,

The previous video had a mongo statement that was similar to mine.

However the notes beneath has a string of numbers before then port number.

What does this string of numbers represent?

Update: Use of the command:

mongo --host “m103-repl/192.168.103.100:27001” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”

also results in the shell not connecting.

Hi @Alisalee_Aaron,

Here the string of number represent the host and port number, in your case, it will be localhost:27001

like this :

mongo admin --host m103-repl/localhost:27001 --username m103-admin --password m103-pass....

Hope it helps!!

Thanks,
Kushagra

This helped plenty! Thank you for the explanation.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.