MongoDB Shell无法启动

时间:2018-12-06 12:19:32

标签: mongodb

我必须连接到我的MongoDB服务器,我要为其启动mongo-shell。
当我使用命令时:

mongo --host="my.mongo.server.com:1529" mydb --username="myuser" --password="mypassword"

它正在启动,但是当我使用完整的连接字符串时:

mongo mongodb://myuser:mypassword@my.mongo.server.com:1529/mydb.mycollection?readPreference=secondary

它没有启动。
我收到错误消息:

MongoDB shell version: 3.0.15
connecting to: mongodb://myuser:mypassword@my.mongo.server.com:1529/mydb.mycollection?readPreference=secondary
2018-12-06T12:16:08.427+0000 E QUERY    Error: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']'; waitlistadmin:adminWaitlist321@ebdp-po-e004d.sys.comcast.net:1529
    at connect (src/mongo/shell/mongo.js:181:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed

我的实际要求是我需要启动mongo-shell,但必须使用参数readPreference=secondary
请指导我该怎么做?

0 个答案:

没有答案