Unable to see collections in mongo DB when connected through R

て烟熏妆下的殇ゞ 提交于 2019-12-02 04:25:53

The below code will return an array of collection names iff the provided database has collections in it. Otherwise, it will return character(0)

try this:

mongo <- mongo.create(host="127.0.0.1:27017" , db="sample")
mongo.get.database.collections(mongo , "sample")

Output: two collections named roles and categories

"sample.roles"          
"sample.categories" 

To get all databases:

mongo <- mongo.create(host="127.0.0.1:27017")
mongo.get.databases(mongo)

To get all collections in a specific database say sample:

mongo.get.database.collections(mongo, "sample")

You can check rmongod link for more info.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!