tc / RMongo

R client to interface with MongoDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switching between databases from authenticate to dbAggregate

tomschenkjr opened this issue · comments

It appears the steps, mongoDbConnect -> dbAuthenticate -> dbAggregate limits the use of switching between databases after authentication. For instance, authenticating with "foo" database, then switching to "bar".

username = ""
password = ""
mongo <- mongoDbConnect("foo")
authenticated <- dbAuthenticate(mongo, username, password)
# Following will not run because data is within "bar" database
counts <- dbAggregate(mongo, "collection", ... )

Would the workaround of making a second connection be suitable?

mongoConn1 <- mongoDbConnect("foo")
mongoConn2 <- mongoDbConnect("bar")