1

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!

Komal Rathi
  • 4,164
  • 13
  • 60
  • 98

0 Answers0