Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (50.2k points)

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... 

1 Answer

0 votes
by (108k points)
edited by

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 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.

Related questions

0 votes
1 answer
0 votes
0 answers
0 votes
2 answers
asked Sep 9, 2019 in SQL by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
asked Mar 15, 2020 in Web Technology by ashely (50.2k points)

Browse Categories

...