create a role for mongodb and restrict database code example
Example 1: mongodb view users
db.getUsers()
Example 2: mongodb readwrite to all dbs
use admin
db.createUser({
user: '<some username>',
pwd: passwordPrompt(), // or '<your password>'
roles: [ "userAdminAnyDatabase", "readWriteAnyDatabase" ]
})