M103 Lab: Creating First Application User

I used the following commands for this lab
mongo --username m103-admin --password m103-pass --authenticationDatabase admin --host localhost:27000

db.createUser({
user:‘m103-application-user’,
pwd:‘m103-application-pass’,
roles:[{role: ‘readWrite’ , db: ‘applicationData’}]
})

Result: Successfully added user: {
“user” : “m103-application-user”,
“roles” : [
{
“role” : “readWrite”,
“db” : “applicationData”
}
]
}

Despite of getting the successful message, all my 3 test cases are failing
3 total, 0 passed, 0 skipped:
[FAIL] “The user m103-application-user was created on the admin database”

Did you create the ‘m103-application-user’ on the admin database?

[FAIL] “The user m103-application-user has the correct permissions”

Did you create the ‘m103-application-user’ with the readWrite role on the
applicationData database?

Any idea what I may be doing wrong here?

1 Like

The following

is hinting you about a missing step that starts with

use DatabaseNameWhereYouNeedToCreateTheNewUser

Thanks Steeve, I was missing use db option . Its working for me now.

1 Like