Transfer large MongoDB collections to data.frame in R with rmongodb and plyr

狂风中的少年 提交于 2019-11-30 10:33:12

I would say all this is not needed. You can proceed in simple way as follows: This requires a package named "rmongodb" in R. This package require latest version and would not be present in the earlier versions. This package deals with mongodb. There are other packages as well such as "RMongo".

for installing rmongodb in R

install.packages("rmongodb")

To convert large data of MongoDB into a data frame in R

library(rmongodb)
mongo <- mongo.create() # create a connection to mongodb localhost
mongo.is.connected(mongo) # check whether mongodb is connected
mongo.get.databases(mongo) #shows all databases present in mongodb
mongo.get.database.collections(mongo,"mydb") #displays all collections present in database mydb
data <- mongo.find.all(mongo,"mydb.collection",data.frame=TRUE) # This would suffice as this would convert the entire list into a data frame in R.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!