0
0
MongoDBquery~10 mins

Built-in roles (read, readWrite, dbAdmin) in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to grant the read role to a user on the database.

MongoDB
db.createUser({user: "reportUser", roles: ["[1]"]})
Drag options to blanks, or click blank then click option'
Aread
BreadWrite
CdbAdmin
Droot
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing readWrite grants write permissions, which is more than needed.
2fill in blank
medium

Complete the code to grant the readWrite role to a user on the database.

MongoDB
db.createUser({user: "appUser", roles: ["[1]"]})
Drag options to blanks, or click blank then click option'
Aread
BdbAdmin
CreadWrite
Dbackup
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing read only allows reading, not writing.
3fill in blank
hard

Fix the error in the code to grant the dbAdmin role to a user.

MongoDB
db.createUser({user: "adminUser", roles: ["[1]"]})
Drag options to blanks, or click blank then click option'
AdbAdmin
Bread
CreadWrite
DuserAdmin
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing readWrite or read does not provide admin privileges.
4fill in blank
hard

Fill both blanks to create a user with readWrite and dbAdmin roles.

MongoDB
db.createUser({user: "managerUser", roles: ["[1]", "[2]"]})
Drag options to blanks, or click blank then click option'
AreadWrite
Bread
CdbAdmin
Dbackup
Attempts:
3 left
💡 Hint
Common Mistakes
Using read instead of readWrite limits write access.
5fill in blank
hard

Fill all three blanks to create a user with read, readWrite, and dbAdmin roles.

MongoDB
db.createUser({user: "fullAccessUser", roles: ["[1]", "[2]", "[3]"]})
Drag options to blanks, or click blank then click option'
Aread
BreadWrite
CdbAdmin
DuserAdmin
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting one of the roles reduces permissions.