本文共 1168 字,大约阅读时间需要 3 分钟。
dbAdmin 在db范围内包括下面的权限: collStats dbHash dbStats find killCursors listIndexes listCollections dropCollection 和 createCollection on system.profile only userAdmin在db范围内包括如下权限: changeCustomData changePassword createRole createUser dropRole dropUser grantRole revokeRole viewRole viewUser readAnyDatabase 对所有数据库中的collection可读,同时包含listDatabases权限 readWriteAnyDatabase 对所有数据库中的collection可读且可写,同时包含listDatabases权限 userAdminAnyDatabase 对所有数据库拥有userAdmin角色,同时包含listDatabases权限 dbAdminAnyDatabase 对所有数据库拥有dbAdmin角色,同时包含listDatabases权限 cluster相关的权限 clusterMonitor、hostManager、clusterManager、clusterAdmin root权限:包含 readWriteAnyDatabase, dbAdminAnyDatabase, userAdminAnyDatabase 和 clusterAdmin 等角色。 但不能访问system. 开头的collection(root does not include any access to collections that begin with the system. prefix.) __system:超级角色权限 相关官方文档: http://docs.mongodb.org/manual/reference/built-in-roles/#__system http://www.tuicool.com/articles/fMZbUzu ------------------------------------------------------------------- 举例: use webdb db.createUser( { user: "user", pwd: "123", roles: [{ "role" : "root","db" : "admin"},"readWrite"] } ) 在webdb数据库上创建user用户,对admin数据库 具有 root 权限,对webdb数据具有 可写可读权限转载地址:http://ilebb.baihongyu.com/