我试图通过引用[this] [1]教程来连接模数上的MongoDB数据库。
我已经在模块.io中注册并收到了数据库网址。 ( Modulus提供您需要的数据库URL,您可以使用mongoose.connect连接到它)
即
MONGO URI
mongodb://<user>:<pass>@apollo.modulusmongo.net:27017/wIp4otyd
MONGO CONSOLE
mongo apollo.modulusmongo.net:27017/wIp4otyd -u <user> -p <pass>
但是,当我试图通过node.js和console连接它时,它会向我显示以下错误:
C:\mongodb\bin>mongo apollo.modulusmongo.net:27017/wIp4otyd -u <my_uname> -p <my_pwd>
2016-02-04T12:01:07.097+0530 I CONTROL [main] Hotfix KB2731284 or later update is installed, no need to zero-out data files
MongoDB shell version: 3.2.1
connecting to: apollo.modulusmongo.net:27017/wIp4otyd
2016-02-04T12:01:09.455+0530 W NETWORK [thread1] Failed to connect to 52.6.181.208:27017, reason: errno:10061 No connection could be made because the target ma
chine actively refused it.
2016-02-04T12:01:09.457+0530 E QUERY [thread1] Error: couldn't connect to server apollo.modulusmongo.net:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:226:14
@(connect):1:6
exception: connect failed
完全连接到本地(mongoose.connect('mongodb://localhost/news');
)
但拒绝使用modulus.io(mongoose.connect('mongodb://<my_uname>:<my_pwd>@apollo.modulusmongo.net:27017/wIp4otyd');
)