I want to create the database in mongodb that\'s secure.
Secure means the application has to pass username/password to connect to my database in mongodb.
> use admin
> db.addUser("admin", "xyzxyz")
> use newdb
> db.addUser("newuser", "strongpwd")
ppa
, then it is configured as a service. sudo service mongodb stop
If it was installed from source, stop the process using:
/etc/init.d/mongodb stop
vim /etc/mongodb.conf
auth = true
sudo service mongodb restart
else
mongod --config /etc/mongodb.conf
> show collections
on newdb
should give the error
"$err" : "not authorized for query on newdb.system.namespaces",
"code" : 16550
and should work after
> db.auth("newuser", "strongpwd")
Now the db newdb
is secured.