mongodb connecting to admin database but there is no admin database code example
Example 1: mongodb create admin user for all databases
use admin
db.createUser({ user: "mongoadmin" , pwd: "mongoadmin", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]})
Example 2: mongodb add admin user
use admin
db.createUser({
user: "username",
pwd: "password",
roles: [ "root" ]
})