How to allow creation and deletion of a database or collections with user and password
0
votes
1
answer
260
views
I created a user with the role of **userAdminAnyDatabase**
db.createUser({user: "Username", pwd: "password", roles: [{role: "userAdminAnyDatabase", db: "admin"}]})
and also user with the role of **userAdmin** for a single db in the mongo shell.
db.createUser({user: "Username", pwd: "password", roles: [{role: "userAdmin", db: "myDB"}]})
But when I create or delete collections in **myDB** it's not asking me for the user name or password. What is the point of creating a user then?
I want the creation and deletion of databases and collections only when I give in the admin credentials.
Asked by DragonBorn
(101 rep)
Nov 6, 2017, 07:56 AM
Last activity: May 28, 2025, 12:01 PM
Last activity: May 28, 2025, 12:01 PM