Darko Fabijan wrote this on September 21, 2010
Two beginner Mongo notes
Problem: mongod doesn’t start and the tail of /var/log/mongodb/mongod.log
says :
Mon Sep 20 12:00:16 exception in initAndListen std::exception: old lock file, terminating
Solution: you somehow did not shut down the machine properly the last time. Remove the old lock file:
sudo rm /var/lib/mongodb/mongod.lock
And if you’re on Ubuntu, you can use the new Upstart syntax to start the process via the init.d script that the package from 10gen PPA provides:
sudo start|stop mongodb
Problem: given the following Mongoid document:
class Post include Mongoid::Document field :tags, :type => Array end
you’d like to find all posts that contain a certain tag.
Solution: use any_in
criteria. It may not be obvious from the docs, but it does apply to fields of type Array too:
Post.any_in(:tags => [t])