give user role on database in mongo code example
Example: mongodb readwrite to all dbs
use admin
db.createUser({
user: '<some username>',
pwd: passwordPrompt(), // or '<your password>'
roles: [ "userAdminAnyDatabase", "readWriteAnyDatabase" ]
})