Create a Read Only MongoDB User
There are times when you need account read only access to a database.
To create a read only database user MongoDB, do the following steps:
- Login as a MongoDB administrator.
$ mongo -u admin -p --authenticationDatabase admin
- Show list of database on MongoDB.
>>> show dbs
- Select database.
>>> use edxapp
- Create a new user with permission read only on the database.
>>> db.createUser({user: "edxapp_read", pwd: "password", roles: [{role: "read", db: "edxapp"}]})
- Done.