Lab - Creating First Application User getting error on user creation

db.createUser({user:“m103-application-user”,pwd:“m103-application-pass”,roles:[{db:“applicationData”,role:“readWrite” }]})
2019-08-27T14:06:12.976+0000 E QUERY [thread1] Error: couldn’t add user: there are no users authenticated :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1437:15
@(shell):1:1

Please help ,i checked the spaces in the db but still giving error
i used the config file which is for lab1.2

means you are not authenticated. You may authenticated by giving user name and password to the mongo shell command line. Alternatively you may use https://docs.mongodb.com/manual/reference/method/db.auth/

as far as i understand without user creation successful, how can i use db.auth
we can authenticate the user once it is created.

Please correct me if i am wrong

You have created another user before.

Hi @baishakhi_81883,

The user is already created. Please re-launch your mongod process and simply authenticate the user as per the guidelines mentioned in the below link for auth, for example -

db.auth( “m103-admin”, “m103-pass”)

https://docs.mongodb.com/manual/reference/method/db.auth/

Thanks,
Muskan
Curriculum Support Engineer

Hi all,
I’m having the same issue as baishakhi_81883, following exactly the same command as the one at the top of this thread. I have followed suggestions from Muskan_47318, but this has not worked showing me the error :

switched to db admin

MongoDB Enterprise > db.auth(“m103-application-user”, “m103-application-pass”)

Error: Authentication failed.

0

It seems that I have not created any users at all! This is different to what has been showed on the videos, where the clear confirmation of a new user created was present.
Whatever I type after switching to admin db throws an error that there are no users authenticated.

Please help!

Hi,

I am having exact same problem as you described above, have you managed to resolve it at the end. The below suggestions do not work for me.

Please help!

@krasy8 is having the same problem as @krasy8? :slightly_smiling_face:

Are you logged into the right host and port? And did you initially create the user on the admin db?

Hi,

I have made progress on this now, turned out I was logging on without necessary credentials. I am now confident I have created the user as per instructions but am struggling with validation now, receiving the error:

Client experienced a timeout when connecting to the database - check that mongod

is running on the correct port, and that the ‘m103-application-user’ user

authenticates against the admin database.

Share a screenshot of this login process

problem solved, thank you for responding to me.

Very good :slightly_smiling_face: :+1:

Closing the thread as all the issues has been resolved in this thread.