[ISSUE]: Learning Activity: Creating New Roles

Hello everyone,

I am currently going through the activity: Creating New Roles
In the IDE below, please create a role with the following requirements:

  • The role is created on the admin database
  • The name of the role is insertAndFindTransactions
  • The role allows the actions insert and find on the transactions database
  • The role does not inherit any built-in roles

You will need to authenticate as globalAdminUser in order to create new roles. You can connect to MongoDB and authenticate as globalAdminUser using this command:

mongo admin --port 27000 --username 'globalAdminUser' --password '5xd49$4%0bef#6c&b*d'

Here are the commands that I have entered after successfully connectivity:

use admin

 {
   role: "insertAndFindTransactions",
   privileges: [
     {
        resource: { db: "transactions", collection: "" },
        actions: [ "insert", "find" ]
     }
   ],
   roles: []
 }

I am getting the following error:
[FAIL] “The role insertAndFindTransactions has the actions insert and find on the transactions database”

Did you create the ‘emailsAdmin’ with the dbAdmin role on the emails database?

Can someone help me understand the issue?

Thanks in advance!

Have you created the user on correct DB and with correct name
Check from db.getUsers()
Sometimes typo or blank space before user/rolename can cause issues
If you are unsure drop the user and create again
Also have you given proper role/privs to dbadmin

As you can see from the aforementioned code snippet, I have used exact same approach.

I have tried multiple times.
I have completed the whole course, just stuck on this exercise.

I do not know what the issue was, but it was cleared later on by entering following commands:

mongo admin --port 27000 --username 'globalAdminUser' --password '5xd49$4%0bef#6c&b*d'

use admin

db.createRole(
 {
   role: "insertAndFindTransactions",
   privileges: [
     {
        resource: { db: "transactions", collection: "" },
        actions: [ "insert", "find" ]
     }
   ],
   roles: []
 }
)
3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.