how to create database in mongodb with username and password code example
Example: create admin user in mongodb
use admin
db.createUser(
{
user: "username",
pwd: "password",
roles: [ "root" ]
}
)
use admin
db.createUser(
{
user: "username",
pwd: "password",
roles: [ "root" ]
}
)