Lab: Creating First Application User Issue

I was successfully able to connect to the DB using the below command:
mongo --port 27000 --username m103-admin --password m103-pass --authenticationDatabase admin

However, went I went to create the new user I got the following error:

This was the command I was using to create the user:
db.createUser ({ user: “m103-application-user”, pwd: “m103-application-pass”, roles: [{ role: “readWrite”, db: “applicationData”}]})

Hi @Melanie_Kyono,

Welcome to the MongoDB Community Forum.

Regarding your query,

The query seems completely fine.

We can see from the screenshot you have shared that the user has been already created and exist there but on the test database, which is not correct.

Try creating a user on the admin database.

I hope it resolves your query.
If still there is any question feel free to reach out to us.


Thanks Kushagra! How do I confirm that I’m creating on the admin DB?

1 Like

Hi @Melanie_Kyono,

Before creating user you have to change your database from test db to admin db.

Use the following command to do so

`use <database_name>`


That worked - thank you!

1 Like