Switching between databases from authenticate to dbAggregate
tomschenkjr opened this issue · comments
Tom Schenk Jr commented
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", ... )
Tommy Chheng commented
Would the workaround of making a second connection be suitable?
mongoConn1 <- mongoDbConnect("foo")
mongoConn2 <- mongoDbConnect("bar")