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
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
Sometimes there is simply not enough space.
exception in initAndListen: 15926 Insufficient free space for journals, terminating
If you're on a Mac and used Brew, restarting the service solved it for me:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
You can find this info by running brew info mongodb
.
This is definitely due to your mongo server not running. Since you're on Ubuntu, try doing a sudo /etc/init.d/mongodb start
and then see if your code works.
On a mac, using brew I found that brew info mongodb
and then using then
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
or mongod --config /usr/local/etc/mongod.conf
worked!
had this happen several times now, and here is the solution that works for me:
sudo rm /var/lib/mongodb/mongod.lock
sudo -u mongodb mongod -f /etc/mongodb.conf --repair
sudo start mongodb
sudo status mongodb