I have a monogo DB which I made an admin with
db.createUser(
{
user: "myusename",
pwd: "password",
roles: [ { role: "userAdminAnyDatabase", db: "admin" },{ role: "readWrite", db: "MYDB" }]
}
)
But I want to do authentication only when I want to connect to MYDB. Assume that I want to have other documents line SECONDDOC in MongoDB that it does not need authentication ( or even it could have another type of username and password if it needs to be authenticated to connect to mongo). How could I do it?
My mongo version is 3.6.3