Lab : Deploy a Replica set login error

I try to initiate mongo shell but when i run the following command it throws an error
mongo --port 27001 -user m103-admin -pwd m103-pass
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27001/m103-admin?gssapiServiceName=mongodb
2021-08-18T00:35:07.238+0000 E QUERY [js] Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

The error Authentication failed means wrong user name or password.

Have you created the user? Post the output of https://docs.mongodb.com/manual/reference/method/db.getUsers/

I think the user is already set

Did you execute the step?

3. When this node is running, use the mongo shell to connect and initiate your replica set with rs.initiate(). The shell prompt will read PRIMARY when the election is complete.

Post a screenshot of the whole IDE. We need to see the context of the command in order to help.

I have already completed all steps before this. You can see i repeated the steps until the creation of the admin user


The user is created correctly

Is this the exact command you issued to connect?
Check again with correct syntax

Authentication Options:
-u [ --username ] arg username for authentication
-p [ --password ] arg password for authentication

You should be able to authenticate with this user.

If you cannot it means it has been created on the wrong database. It is hard to tell because we do not see if run

use admin

before db.createUser(…)

I have used use admin before creating the user
image

It looks like you have not press the ENTER key at end of db.createUser().

Yes i have
image

Nice. It looks like you are ready for the next step of the lab. Give it a try and let us know the results.