mongo - ruby connection problem

后端 未结 6 1226
无人及你
无人及你 2020-12-24 03:17

I have installed mongo and bson_ext now I have created a .rb file with the following contents ::

require \'rubygems\'
require \'mongo\'

db = Mongo::Connecti         


        
6条回答
  •  醉话见心
    2020-12-24 03:33

    I just encountered this due to my /etc/hosts file not containing an entry for "localhost" - consequently Ruby couldn't resolve "localhost". I suppose you can hardcode 127.0.0.1 into your code rather than "localhost" - or fix /etc/hosts to contain:

    127.0.0.1 localhost

提交回复
热议问题