I have run the mongod with the default configuration, that is, I have not set the path, nor the port, nor enabled the access control .
p>C:\Program Files\MongoDB\Server.4\bin>mongod
Trying for "more advanced things," I wanted to create the admin user and use that to create other users (as the documentation indicates). But I'm having a lot of trouble yet, many commands return with the following (or something close):
not authorized on admin to execute command
The user admin was created as follows:
use admin
db.createUser(
{
user: "myUserAdmin",
pwd: "abc123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
But it seems to be only authorized to create other users.
I would like to know:
How to create a user and give basic access to a database How to update a user's permissions How to delete a user
The simplest way and straightforward possible! :)
The intention is to start running mongodb with access control :
mongod --auth