92.2k views
3 votes
The following command will grant roles to scott. Which database does the user have readWrite permission?

db.grantRolesToUser(
"scott",
[ "readWrite" , { role: "read", db: "reporting" } ]
)

A) reporting
B) the current database the user is in
C) myDB
D) admin
E) not specified

User Sirrocco
by
7.4k points

1 Answer

1 vote

Final answer:

User 'scott' has readWrite permission in the current database they are connected to, and 'read' permission on the 'reporting' database as per the command given.

Step-by-step explanation:

The command db.grantRolesToUser("scott", [ "readWrite" , { role: "read", db: "reporting" } ] ) grants the user 'scott' two roles. The readWrite role is granted on the current database the user is in, which is not explicitly specified in the command. Since the current database is not mentioned, it is known as the current context of the user session. The 'read' role is specifically granted on the reporting database. Therefore, the user 'scott' has readWrite permission in the current database they are connected to and 'read' permission on the reporting database.

User Pmarflee
by
7.7k points