MongoDb
General
- Install on Ubuntu
- Java Drivers
- Mongo-DB as AMI
- Using MongoDB by means of Kundera: Enables to switch the database product by means of the JPA interface
- Using MongoDB by means of Morphia: Better suited if you know to use MongoDB only
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)
- UMongo
- Rather simple but good tool is UMongo.
- Robomongo
- 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)