Unable to setup a user adminstrator account in mongodb running on fedora -


i have setup mongodb downloading 64 bit legacy linux download on official mongodb website.i started mongod service, , installed mean stack following instructions on meanjs.org website. started server , default boilerplate of meanjs showed up. trying setup user adminstrator mongodb server. there no admin database default, tried following:

use admin db.createuser({ user:”siteuseradmin”, pwd: “useradminpwd” roles: [{role: “useradminanydatabase”,db: “admin”}] }) 

i getting following error:e query syntaxerror: unexpected token illegal there mean-dev database following collections:sessions, system.indexes, users tried creating user adminstrator account in database , got same error.i need guidance setup user adminstrator account.

you might want check mongod.conf , set

auth=true 

after that, restart mongod.

now need use mongo shell on server mongod running on.

your statements correct, completeness:

use admin db.createuser(   {     user: "siteuseradmin",     pwd: "yourpassword",     roles: [ { role: "useradminanydatabase", db: "admin" } ]   } ) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -