The read and readWrite built-in roles can be applied to the database in use or to the database designated specifically when creating a user. Here is a summary of these two roles:
- read: The read built-in role grants the following privilege actions (rights) to the database: changeStream, collStats, dbHash, dbStats, find, killCursors, listIndexes, and listCollections. It's important to note that there are minor differences between implementations in MongoDB versions 4.0 to 4.04 in that granting the read built-in role grants the find right. This right, in turn, enables the user to run listDatabases. As this might not be desirable, it might be necessary to deny the listDatabases right manually. For MongoDB versions 4.05 and above, an additional permission, authorizedDatabases, can be added.
- readWrite: The readWrite built-in role grants all the rights of the read built-in role, with the additional ability to write to the assigned...