RMongo icon indicating copy to clipboard operation
RMongo copied to clipboard

Switching between databases from authenticate to dbAggregate

Open tomschenkjr opened this issue 11 years ago • 1 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", ... )

tomschenkjr avatar Dec 11 '13 01:12 tomschenkjr

Would the workaround of making a second connection be suitable?

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

tc avatar Dec 11 '13 06:12 tc