Aus Wiki
Zur Navigation springen Zur Suche springen


Technical details

Starting / Stopping

By means of 'service':

sudo service mongodb start
sudo service mongodb stop
sudo service mongodb restart

or directly as equivalent (command blocks):

sudo mongod --dbpath=/var/lib/mongodb --port=27017

Additionally you can append --rest which opens a port for some analyses (See HTTP interface): Point Internet browser to: http://localhost:28017 (This seems to work defaultly...)

If PC got unexpected restarted:

sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --dbpath=/var/lib/mongodb --repair

Administration Tools (see here)

Rather simple but good tool is UMongo.
Looks rather impressive but I didn't manage to install on my Ubuntu 10.04 box: Either packages were too old or C++ library were missing. (Give a try later...)

Typical commands

drop collection
db.<collection name>.drop()
handle collection names with specific characters
If you have e.g. a collection named 'server-session' you have to query it in JavaScript-fashion: db["server-session"].find() (see here)