User Management Methods用户管理方法

Note

For details on specific methods, including syntax and examples, click on the specific method to go to its reference page.有关特定方法的详细信息,包括语法和示例,请单击特定方法以转到其参考页面。

Name名称Description描述
db.auth() Authenticates a user to a database.对数据库中的用户进行身份验证。
db.changeUserPassword() Changes an existing user’s password.更改现有用户的密码。
db.createUser() Creates a new user.创建一个新用户。
db.dropUser() Removes a single user.删除单个用户。
db.dropAllUsers() Deletes all users associated with a database.删除与数据库关联的所有用户。
db.getUser() Returns information about the specified user.返回有关指定用户的信息。
db.getUsers() Returns information about all users associated with a database.返回与数据库关联的所有用户的信息。
db.grantRolesToUser() Grants a role and its privileges to a user.将角色及其权限授予用户。
db.removeUser() Deprecated. 不赞成。Removes a user from a database.从数据库中删除用户。
db.revokeRolesFromUser() Removes a role from a user.从用户中删除角色。
db.updateUser() Updates user data.更新用户数据。
passwordPrompt() Prompts for the password as an alternative to specifying passwords directly in various mongo shell user authentication/management methods.提示输入密码,以替代在各种mongo shell用户身份验证/管理方法中直接指定密码。