I'm struggling to make a successful connection to a mongodb.
Here is what I did.
I setup the server following the instructions in some tutorials.
I ran this command from terminal
mongo 'mongodb://AdminSammy:test56789@localhost'
and got connection successfully.
AdminSammy is a user with Admin privilege, so, I created a database myshinynewdb and a table successfully with the user, following a doc.
what I'm confused about is
both these 2 commands
mongo 'mongodb://localhost/test'
mongo 'mongodb://AdminSammy:test56789@localhost'
can get connection successfully
whereas this one
mongo 'mongodb://AdminSammy:test56789@localhost/test'
cases
Error: Authentication failed.
Is it caused by the following config from the tutorial I mentioned at the beginning?
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
How do I fix it?