You can create database users to suit the purposes of administration and also to control access from applications that are using MongoDB programming language drivers. Here is a list of the more important mongo shell database commands that are used to manage users:
- db.getUser("<name>"): Retrieves information on user <name>
- db.createUser(<user document>): Creates a user
- db.changeUserPassword("<name>", "<new password>"): Changes password for existing user <name>
- db.updateUser("<name>",<update document>): Updates user <name> with the information in <update document>
- db.dropUser("<name>"): Removes user <name> from the database
In the following example, we are creating a user called sweetsBasic who has readWrite ...