docker-compose exec --user root db /bin/bash
docker-compose exec --user root db mongo
Username: root
Password: password
While in the shell, run the following:
use admin;
db.auth("root", "password");
use myDatabase;
db.createUser({user: "root", pwd: "password", roles:[{role: "readWrite" , db:"myDatabase"}]});