10.5角色管理
创建自定义角色:
db.createRole({role:"onlyReadForCustomers", privileges:[{resource:{db:"crm",collection:"customers"}, actions:["find"]}], roles:[]})
结果1

结果2
删除自定义角色:
db.dropRole(“onlyReadForCustomers”)db.dropAllRoles()
创建自定义角色:
db.createRole({role:"onlyReadForCustomers",
privileges:[{resource:{db:"crm",collection:"customers"},
actions:["find"]}], roles:[]})

结果1

结果2
删除自定义角色:
db.dropRole(“onlyReadForCustomers”)
db.dropAllRoles()