rmongodb icon indicating copy to clipboard operation
rmongodb copied to clipboard

mongo.get.database.collections return empty vector

Open fxjollois opened this issue 8 years ago • 6 comments

Hi,

the function mongo.get.database.collections returns an empty character vector, even if the database has one or more collections. I use R 3.2.3, and the latest version of Rmongodb.

Here is the R code:

> library(rmongodb)
> con = mongo.create(host = "iphost")
> mongo.is.connected(con)
[1] TRUE
> mongo.get.databases(con)
[1] "gym"         "horodateurs" "test"       
> mongo.get.database.collections(con, "test")
character(0)

And when I test on mongo shell:

MongoDB shell version: 3.2.4
connecting to: test
> use test
switched to db test
> show collections
restaurants

I see that other users encounter the same issues, but I do not see any way to get the collections list.

FX Jollois

fxjollois avatar Mar 15 '16 14:03 fxjollois

I'm afraid this is not possible with current version of rmongodb and underlying C drivers. As far as I know issue is related to "wired tiger" engine which is default engine from mongodb 3.0. When I was an active user of mongodb I also had such issues with robomongo IDE. (fortunately know it maintained better than 1 year ago).

And I suggest to try mongolite package which is much more actively maintained.

dselivanov avatar Mar 15 '16 15:03 dselivanov

Thanks for your answer.

fxjollois avatar Mar 18 '16 10:03 fxjollois

I have exactly the same issue. My R version is 3.2.2 and MongoDB 3.2.4.

chrisd31 avatar Mar 23 '16 20:03 chrisd31

By the way, just found a workaround: mongo.command(mongo = con, db = "test", command = list(listCollections=1))

chrisd31 avatar Mar 23 '16 21:03 chrisd31

Thanks a lot !

fxjollois avatar Mar 25 '16 08:03 fxjollois

@chrisd31 thanks for sharing. Can you open PR with this workaround?

dselivanov avatar Mar 25 '16 08:03 dselivanov