When i try creating user in mongodb or try to fetch users using getUsers(), i am said i am not authorised. I have freshly used a new --dppath.
> use admin;
switched to db admin
> db.getUsers();
2018-04-16T10:16:29.858+0530 E QUERY [thread1] Error: not authorized on admin to execute command { usersInfo: 1.0 } :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.getUsers@src/mongo/shell/db.js:1537:1
@(shell):1:1
And similarly creating a user also throwing same permission issue.
couldn't add user: not authorized on admin to execute command { createUser: "myUserAdmin", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ], digestPassword: false, writeConcern: { w: "majority", wtimeout: 600000.0 } } :
Do i need to uninstall the Mongodb in my windows machine now, because i already tried changing the --dbpath. If anyything wrong happens in configuration, i hope mongodb stores everything in this path(--dbpath) only and not anywhereelse.
Guys any knowhow??
Related stackoverflow resource : Creating first user in MongoDB 3.2.
Regards, Nilotpal