Lab: Creating First Application user

I have been trying to solve this for several hours now, the guides here are ridiculous since there is literally nothing to work off of. I start the mongod with the following conf file:
dbPath: /var/mongodb/db
port: 27000
authorization: disabled

Setting auth to enabled makes me unable to start it.
with it running, I then try to connect using the following:
mongo admin -u m103-admin -p m103-pass

No matter what, I am always unable to connect, constantly giving me the following message:
MongoDB shell version v4.0.5
connecting to: mongodb://
2020-12-18T17:17:11.774+0000 E QUERY [js] Error: couldn’t connect to server, connection attempt failed: SocketException: Error connecting to :: caused by :: Connection refused :
exception: connect failed

I have no clue what I did wrong, and there are no materials to work off of since the videos barely explain things.

EDIT: I am able to connect to the port 27000 by using mongo --port 27000 but now I am unable to create a user.

Post a screenshot of what you are trying that shows the error you are getting.

Nobody can help with just:

My bad. Here is my full flow
use admin
switched to db admin

… { user: “m103-application-user”,
… pwd: “m103-application-pass”,
… roles: [ { db: “applicationData”, role: “readWrite” } ]
… }
… )
2020-12-18T18:14:57.797+0000 E QUERY [js] Error: couldn’t add user: command createUser requires authentication :

You are missing a critical step.

Only the first user can be created without authentication. The lab states

The m103-admin user has also already been created for you with password m103-pass.

That’s what the error message

is telling you.

1 Like