Mongodb admin user not authorized
MongoDB is a free and open-source cross-platform document-oriented database. Classified as a NoSQL database, MongoDB avoids the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.
Here the mongodb admin user is showing the message "not authenticated" still after assigning admin role.
This can be solved by the role to be root when adding the first admin user.
Step1: Login to mongo shell
Step2: Changed the database to admin
use admin
Step3: Create user
db.createUser(
{
user: "admin",
pwd: "password",
roles: [ { role: "root", db: "admin" } ]
}
);
Step4: exit
exit;
That's all....