MONGODB DOC 手册 —— 内置的角色(例如:userAdmin等)
原文:---------------------------------------------
Database Administration Roles
Every database includes the following database administration roles:
Role |
Short Description |
---|---|
dbAdmin |
Provides the ability to perform administrative tasks such as schema-related tasks, indexing, and gathering statistics. This role does not grant privileges for user and role management. For the specific privileges granted by the role, see |
dbOwner |
The database owner can perform any administrative action on the database. This role combines the privileges granted by the readWrite , dbAdmin and userAdmin roles. |
userAdmin |
Provides the ability to create and modify roles and users on the current database. Since the For the specific privileges granted by the role, see |
度娘机翻:-------------------------------------------
数据库管理角色
每个数据库包括数据库管理角色:
的作用 | 简短的描述 |
---|---|
dbadmin |
提供执行管理任务如 模式相关的任务,索引的能力,和收集统计。这个角色 不授予权限的用户和角色管理。 对于具体的角色授予的特权,看 |
dbowner |
数据库所有者可以在数据库上执行的任何行政行为。 这个角色权限的结合读写 ,dbadmin 和useradmin 角色。 |
useradmin |
提供创建和修改的 当前数据库角色和用户的能力。自 对于具体的角色授予的特权,看 |
这里说明了userAdmin是没readWrite权限的,需要加上readWrite权限才能在auth下 show collections
权限创建:
use admin
db.createUser(
{
user:'admin',
pwd:'admin123',
roles:
[
{role:'userAdmin',db:'admin'},
{role:'readWrite',db:'admin'},
]
}
)