我的 Mongo 查询有什么问题?

Whats wrong with my Mongo query?

我最近在我的 vi 中设置了一个路径。bash_profile 到我的 mongo 命令。我知道这有效,因为它昨天有效。

然而,当我现在这样做时,我得到了这个错误:

AMAC02MX3APF8J3:~ james.flan$ mongo
MongoDB shell version: 3.0.3
connecting to: test
2015-05-19T11:34:58.708+0100 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-05-19T11:34:58.710+0100 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
    at connect (src/mongo/shell/mongo.js:179:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed

这是我vi里面的内容bash_profile:

alias mongod="mongod --dbpath /Users/ryan.garrett/Documents/Software/MongoDB/data"
export PATH="/Users/ryan.garrett/Documents/Software/MongoDB/bin:$PATH"

有人可以告诉我如何连接到服务器吗?

检查您的 /etc/hosts 本地主机条目,并确保 mongod 正在侦听所有接口,您可以通过 netstat -an|grep mongo.[=10 检查=]