Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

How do mongo create user as admin for any database?

Asked by Deepak Mistry Sep 30, 2022 1.1K views 1 answer
Share

About this question

 I am trying to create a simple user with the right permission to access any database and can do any actions. When I trying to execute the create User command I got this error:

db.createUser({ user: "mongoadmin" , pwd: "mongoadmin", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]}) 2015-08-20T17:09:42.300+0000 E QUERY Error: couldn't add user: No role named userAdminAnyDatabase@new_vehicles_catalog

The problem above only happens when I enable the auth configuration and I need it.

So, How do I create a user with admin permission for any database? I want it because I configured my mongo services to use authentication connections. If I want to execute a dump of my data I have to use these authentication parameters.

Please help?

Using mongo version 3.0.5.

the service is on Amazon Linux AMI 2015.03 (HVM), SSD Volume Type - ami-1ecae776

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.