Skip to content

Switch to and query database other than authentication database #46

@komalsrathi

Description

@komalsrathi

Hi,

I am using RMongo to connect to MongoDB.

# this is how I connect using the mongo driver:
mongo -u user -p pass --authenticationDatabase "admin" --port 27018
# after I get in the database, I switch to test and query it
use test

# Now in R, this works perfectly
mg1 <- mongoDbConnect(dbName = 'admin', host = 'localhost', port = '27018')
auth <- dbAuthenticate(rmongo.object = mg1, username = 'user', password = 'pass')

However, I want to switch to another database called test and query it. How can I do that?

Thanks,
Komal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions