Use MongoDB with Java and need, through Java execute the following command in mongoDB:
db.grantRolesToUser( "joao", [ {role:"dbOwner",db:"loja"} ] )
That is, I need to add a role to an existing user, and I need to specify the database. After much breaking my head, I still can not find the right way. Remember that in the command I need to specify the database (as above), because at that moment I will be logged in the admin database, so I have to say that the command refers to the database store. I keep looking. But if anyone knows and can give me a clue, thank you!