Docs HomeMongoDB Manual

User Management Methods用户管理方法

Note

For details on a specific method, including syntax and examples, click on the link to the method's 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 mongosh user authentication/management methods.提示输入密码,以代替在各种mongosh用户身份验证/管理方法中直接指定密码。