For our next scenario, let's say that management wants a senior admin to have the ability to not only run financial reports on any hosted databases, but have the ability to perform create, update, and delete operations as well. Here is an example of how the rights might be assigned:
use admin;
rwAll = {
user : "rwAll",
pwd : "password",
roles : [ "readWriteAnyDatabase" ],
mechanisms: [ "SCRAM-SHA-256" ]
}
db.createUser(rwAll);
This user can now authenticate to the server using the mongo shell, specifying the -u and -p parameters. As you can see from the following screenshot, the rwAll user can perform read and write operations on both the sweetscomplete and biglittle databases:
Administrative built-in roles are examined in the next subsection.