Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB "root" user

Is there a super UNIX like "root" user for MongoDB? I've been looking at http://docs.mongodb.org/manual/reference/user-privileges/ and have tried many combinations, but they all seem to lack in an area or another. Surely there is a role that is above all the ones listed there.

like image 722
No_name Avatar asked Nov 21 '13 09:11

No_name


People also ask

What is the MongoDB root user?

The superuser role in MongoDB is the root.

What is a MongoDB user?

Centralized User Data For users created in MongoDB, MongoDB stores all user information, including name , password , and the user's authentication database , in the system. users collection in the admin database. Do not modify this collection directly. To manage users, use the designated user management commands.

How do I list a user in MongoDB?

To list existing users in MongoDB, you can use the db. getUsers() method to show all of the users within the current database.


1 Answers

The best superuser role would be the root.The Syntax is:

use admin  db.createUser( {     user: "root",     pwd: "password",     roles: [ "root" ] }) 

For more details look at built-in roles.

Hope this helps !!!

like image 149
Jerry Avatar answered Sep 24 '22 07:09

Jerry