mongoimport错误-失败:连接到数据库服务器时出错:没有可访问的服务器

问题描述:

我目前正在尝试学习mongodb,但无法找到解决该问题的方法. 当我运行mongoimport命令时,出现以下错误:

I am currently trying to learn mongodb and I am having trouble finding a solution for this problem. When I run a mongoimport command it I get the following error:

~ mongoimport --host localhost --port 27017 --db test --collection people --file ~/Downloads/mongodb-consultas.json --jsonArray
2015-09-27T20:46:03.228-0600    [........................] test.people  0.0 B/684.2 KB (0.0%)
2015-09-27T20:46:03.745-0600    Failed: error connecting to db server: no reachable servers
2015-09-27T20:46:03.745-0600    imported 0 documents

我通过在命令行中运行mongod来拥有mongodb服务器.

I have a mongodb server by running mongod in the command line.

我的MongoDB Shell版本是3.0.6.

My MongoDB shell version is 3.0.6.

谢谢!

您需要使用--host 127.0.0.1:27017

You need to use --host 127.0.0.1:27017