An important distinction we need to make right away is to describe the difference between authentication and authorization:
- Authentication:Â Authentication proves the identity of an entity attempting to access the database. The entity could be a DevOp connecting through the mongo shell, or an application performing a database read or write operation. As an analogy, when traveling from one country to another, a traveller is asked to display a passport that contains identifying information before being allowed to enter the country.
- Authorization: Authorization determines what actions the entity is allowed to perform once authentication is granted. Thus, authentication precedes authorization: MongoDB needs to know who you are before determining your ability to perform the requested action. As an analogy, once the traveler successfully crosses the border, that person's role determines what activities they can perform. Thus, for example...