Now just to come back to what I ended with in the previous lecture. We use roles because we typically
of course have more than one type of database user.
If we are building an online shop application, even then we have more than one database user,
we will probably have some administrator,
so a real person who actually needs to be able to manage the database configuration, create other users
maybe, create new databases, create new collections,
stuff like that
and you could even split that up into different roles but we might have such a super administrator who
does all that heavy lifting
but this administrator will not be required to actually work with the data in the database. The administrator
will not be required to insert or fetch data,
so this would be one role we typically have. Then we would have the developer,
so the app and I'm putting this into one role because you are the developer, you are a real person
but of course you are writing some code where the code is in the end
what it will insert or fetch data,
so in the end, the app is the user you could say. And the app and therefore you as a developer, you need
to be able to insert, update, delete or fetch data,
so all these crud operations, which is why we heavily focus on these in this course this is a developer's
course but you will not need to create users or manage the database configuration,
this is not your job
and the app code shouldn't be able to do that because if someone is able to access this code somehow,
suddenly this person can start changing your code and do bad things to your database.
So again, we'll focus on that developer part in this course but for the big picture, it's important that
you understand how authentication and roles and security in general work in mongodb.
Now last but not least to complete that picture, in that same app we're building,
let's say a shop,
we might also have a data scientist who analyzes our sales.
Now this real person needs to be able to fetch data but certainly not to do any database configuration
or start editing, inserting or deleting data.
So this is why we have this role based concept in mongodb.