Closed dselivanov closed 10 years ago
Your issue was already fixed on the latest github version 1.5.1 (not on CRAN). I added your idea with simplify (default=FALSE) to mongo.bson.to.list. This is now part of version 1.5.3 which I will push to CRAN today.
Example:
library(rmongodb) test <- mongo.bson.from.JSON('{"d":1, "value":1, "string":"test"}') test d : 1 1.000000 value : 1 1.000000 string : 2 test mongo.bson.to.list(test) $d [1] 1
$value [1] 1
$string [1] "test"
mongo.bson.to.list(test, simplify=TRUE) d value string "1" "1" "test" sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] rmongodb_1.5.2 jsonlite_0.9.3 roxygen2_3.0.0
Hi. There is one issue with mongo.bson.to.list. It tries to simplify results and make from them named vector instead of lilst. So if I have {id:1, value:1} it converts it into named vector. But if I have {id:1, value:1, string: 'test'} mongo.bson.to.list return list. I think this function have to have option like 'simplify' in sapply function.