本篇适用情形: MongoDB 启用权限控制 MongoDB 用户管理 了解MongoDB 内置角色 正文: 【1】内建角色介绍 Built-In Roles Database User Roles (exist in each database.) read readWrite Database Administration Roles (exist in each database.) dbAdmin userAdmin dbOwner (readWrite + dbAdmin + userAdmin) All-Database Roles (in the admin database apply to all but the local and config databases) readAnyDatabase readWriteAnyDatabase userAdminAnyDatabase dbAdminAnyDatabase Superuser Roles root (readWriteAnyDatabase + dbAdminAnyDatabase + userAdminAnyDatabase + clusterAdmin) 【2】用户基本操作 //查看现有用户 > use admin > db.system.users.find() //删除用户dbuser > use admin > db.system.users.remove({user:"dbuser"}); //创建管理用户dbadmin > use admin > db.createUser({ user:"dbadmin", pwd:"passowrd", roles: [{ role: "root", db: "admin" }] }); //为db_files库创建读写权限用户dbuser > use db_files > db.createUser({ user:"dbuser", pwd:"passowrd", roles: [{ role: "dbOwner...