我正在尝试按照“Getting started with MongoDB in R”页面启动并运行数据库。我在我的PATH中安装了mongoDB,因此我可以从终端运行mongod
并打开一个实例。虽然我在后台打开一个实例并尝试在R中运行以下命令:
library(mongolite)
m <- mongo(collection = "diamonds") #diamonds is a built in dataset
在最后一条声明之后抛出错误:
Error: No suitable servers found (`serverSelectionTryOnce` set): [Failed to resolve 'localhost']
如何启用它以查找我已打开的连接?或者是别的什么?感谢。
答案 0 :(得分:0)
可能是mongolite在错误的位置查找了本地服务器。我通过在连接调用中显式添加本地主机地址为自己解决了同样的问题:
imageFile.getDataInBackground(block: { (data, error) in
...
})