Back
Do we have a "root" user for MongoDB? I have also referred to the official docs and have implemented many combinations, but couldn't able to get the answer...
Note that MongoDB is not having any authentication, for developing the reet user you can use any role and assign that role to a particular user in the admin database. You can refer the following implementation for assigning the role to a particular user:
use admindb.addUser( { user: "<username>", pwd: "<password>", roles: [ "userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"] } )
use admin
db.addUser( { user: "<username>",
pwd: "<password>",
roles: [ "userAdminAnyDatabase",
"dbAdminAnyDatabase",
"readWriteAnyDatabase"
] } )
Do you want to be a full-stack developer? Enroll in this Full Stack Certification to get started with your journey.
31k questions
32.8k answers
501 comments
693 users