Reputation: 17521
I have created a user for my database dbase
with a read
role with the following command:
db.createUser({user: "user" , pwd: "password" , roles: [{role: "read", db: "dbase"}] })
The problem is he can still insert
and remove
a document from the collection. How do I properly set up a read only user in MongoDB?
Upvotes: 4
Views: 936
Reputation: 6268
Allright, I found it.
You have to enable client access control by doing the following:
/etc/mongod.conf
filesecurity:
authorization: enabled
sudo service mongodb restart
Upvotes: 3