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'},
]
}
)