我在默认mongod
的命令窗口中执行了localhost:27017
。
现在,在另一个cmd窗口中,如果我尝试在IRB中创建Mongo::Client
的实例,我会不断收到重复的错误消息:
db = Mongo::Client.new('mongodb://localhost:27017')
# D, [2018-02-08T20:19:08.300889 #2392] DEBUG -- : MONGODB | Topology type 'unknown' initializing.
# D, [2018-02-08T20:19:08.300889 #2392] DEBUG -- : MONGODB | Server localhost:27017 initializing.
# D, [2018-02-08T20:19:08.317054 #2392] DEBUG -- : MONGODB | An address incompatible with the requested protocol was used. - connect(2) for [::1]:27017
#=> #<Mongo::Client:0x39242556 cluster=localhost:27017>
# D, [2018-02-08T20:19:18.321547 #2392] DEBUG -- : MONGODB | An address incompatible with the requested protocol was used. - connect(2) for [::1]:27017
# D, [2018-02-08T20:19:28.324674 #2392] DEBUG -- : MONGODB | An address incompatible with the requested protocol was used. - connect(2) for [::1]:27017
# ...
基本上我不断得到的错误是An address incompatible with the requested protocol was used.
虽然像db.database.name
这样的命令会返回正确的名称。我如何解决它 ?这是否与使用IPv4套接字连接到IPv6网络有关?