Using MongoDB Built-in Roles: read, readWrite, dbAdmin
📖 Scenario: You are managing a small company's database using MongoDB. Different team members need different access levels to the database collections. You will assign built-in roles to users to control their permissions.
🎯 Goal: Assign MongoDB built-in roles read, readWrite, and dbAdmin to users on a database called companyDB.
📋 What You'll Learn
Create three users with exact usernames:
readerUser, writerUser, and adminUserAssign the
read role on companyDB to readerUserAssign the
readWrite role on companyDB to writerUserAssign the
dbAdmin role on companyDB to adminUser💡 Why This Matters
🌍 Real World
In real companies, database access must be controlled carefully. Assigning built-in roles helps secure data and limits user actions to what they need.
💼 Career
Database administrators and backend developers often create and manage users with roles to protect data and ensure proper access control.
Progress0 / 4 steps