Hi Steevej,
Thanks for your response.
Yes, it was my mistake of not giving an attention to it. It worked but based on the following lab instructions:
Use the db.createUser() command to create a user for a CRUD application.
The requirements for this new user are:
- Role: readWrite on applicationData database
- Authentication source: admin
- Username: m103-application-user
- Password: m103-application-pass
I have tried to execute the following createUser & grantRolesToUser commands.
db.createUser(
{ user: “m103-application-user”,
pwd: “m103-application-pass”,
roles: [ { db: “admin”, role: “dbAdmin” } ]
}
)
db.grantRolesToUser( “m103-application-user”, [ { db: “applicationData”, role: “dbOwner” } ] )
When I press the RunTest it gave me the following errors:
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?
[FAIL] “The user m103-application-user has the correct password”
Did you create the ‘m103-application-user’ with the password
‘m103-application-pass’?
Reset Workspace
Explanation of the Error messages:
1.
[FAIL] “The user m103-application-user was created on the admin database”
Did you create the ‘m103-application-user’ on the admin database?
Yes, based on the “db.createUser” the user “m103-application-user” has been created on the “admin” database (db: “admin”). What is wrong here?
-
[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?
Based on “grantRolesToUser” the user “m103-application-user” has been granted readWrite role (role: “dbOwner”) on the applicationData database (db: “applicationData”). What is wrong here?
-
[FAIL] “The user m103-application-user has the correct password”
Did you create the ‘m103-application-user’ with the password
‘m103-application-pass’?
Yes, based on the “db.createUser” the user “m103-application-user” (user: “m103-application-user”) has been created with the password “m103-application-pass” (pwd: “m103-application-pass”) as per lab instructions. What is wrong here?
Thanks in advance for your help.
Regards,
Mahantesh