Reputation: 750
When i connect using from the OS shell,
mongo --port 27017 -u "testusr" -p "testpwd" --authenticationDatabase "testdb"
Instead of switching taking me to testdb, it always logs me into test database? What I am missing here?
db.auth("testusr","testpwd")
is working wihtout any authentication issues?
How do I redirect to the correct database?
Upvotes: 0
Views: 620
Reputation: 1212
The following works for me
mongo localhost:27017/testdb -u "user" -p "pass" --authenticationDatabase "testdb"
You can find help(i used in linux)
mongo --help
usage: mongo [options] [db address] [file names (ending in .js)]
db address can be:
foo foo database on local machine
192.169.0.5/foo foo database on 192.168.0.5 machine
192.169.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999
Upvotes: 1