I have a mongodb like this:
# works
mongo -u user -p pass --authenticationDatabase "admin" --port 27018
# switch to test
use test
# does not work
mongo -u user -p pass --authenticationDatabase "test" --port 27018
I am using RMongo
to connect to mongodb:
mg1 <- mongoDbConnect(dbName = 'admin', host = 'localhost', port = '27018')
auth <- dbAuthenticate(rmongo.object = mg1, username = 'user', password = 'pass')
I want to switch to another database test
but I don't know how to do it in RMongo
. How do you switch to another database using RMongo
?
Thanks!