0
0
MongoDBquery~5 mins

Role-based access control in MongoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Role-based Access Control (RBAC) in MongoDB?
RBAC is a way to manage who can do what in MongoDB by assigning roles to users. Each role has specific permissions that control access to database actions.
Click to reveal answer
intermediate
How do you create a custom role in MongoDB?
Use the db.createRole() command with a role name, privileges (actions on resources), and optionally inherited roles.
Click to reveal answer
beginner
What is the difference between a built-in role and a custom role in MongoDB?
Built-in roles come predefined with MongoDB and cover common permissions. Custom roles are created by users to tailor permissions for specific needs.
Click to reveal answer
beginner
Which MongoDB command assigns a role to a user?
The db.grantRolesToUser() command assigns one or more roles to an existing user.
Click to reveal answer
beginner
Why is it important to follow the principle of least privilege in RBAC?
It limits users to only the permissions they need, reducing the risk of accidental or malicious data access or changes.
Click to reveal answer
Which command creates a new role in MongoDB?
Adb.createRole()
Bdb.createUser()
Cdb.grantRolesToUser()
Ddb.addRole()
What does a role in MongoDB define?
AA set of permissions
BA collection
CA database
DA set of users
Which command assigns roles to an existing user?
Adb.createUser()
Bdb.grantRolesToUser()
Cdb.createRole()
Ddb.addUserRole()
What is the principle of least privilege?
AUsers get all permissions
BUsers get no permissions
CUsers share permissions
DUsers get only permissions they need
Which of these is NOT a built-in MongoDB role?
AreadWrite
BdbAdmin
CsuperUser
Dread
Explain how role-based access control works in MongoDB and why it is useful.
Think about how you give keys to rooms only to people who need them.
You got /4 concepts.
    Describe the steps to create a custom role and assign it to a user in MongoDB.
    First create the role, then give it to the user.
    You got /4 concepts.