Complete the code to create a custom role named "readWriteReports".
db.createRole({ role: "readWriteReports", privileges: [], [1]: ["read"] })The roles field defines inherited roles for the new custom role.
Complete the code to add a privilege that allows reading from the "reports" collection.
db.createRole({ role: "readReports", privileges: [{ resource: { db: "analytics", collection: "reports" }, [1]: ["find"] }], roles: [] })The actions field lists the operations allowed on the specified resource.
Fix the error in the role creation by completing the missing field for resource specification.
db.createRole({ role: "writeLogs", privileges: [{ [1]: { db: "logsDB", collection: "logs" }, actions: ["insert", "update"] }], roles: [] })The field resource specifies the database and collection the privileges apply to.
Fill in the blank to create a role that inherits from "read" and "write" roles.
db.createRole({ role: "readWrite", privileges: [], [1]: ["read", "write"] })The roles field is an array listing roles this custom role inherits from.
Fill all three blanks to create a role with a privilege allowing "remove" action on "temp" collection in "testDB".
db.createRole({ role: "tempRemover", privileges: [{ [1]: { db: [2], collection: [3] }, actions: ["remove"] }], roles: [] })The resource field specifies the database and collection. Here, db is "testDB" and collection is "temp".