Creating a Database and Password

Admitting that the admin user is named admin and that the password for the admin user is password123, the mongo command-line can be reached by executing the following command:

mongo -u admin -p password123

The following instructions in succession can then be used to create a database and then a user named test with the password also test and with ownership rights granted on the database main:

use main
db
db.createUser({user: "main", pwd: "main", roles: [{role: "dbOwner", db: "main"}]});