MongoDB
by Scott, Revised on September 1, 2015 (Databases, Open Source)
Note: My current plan would be to stop using this db, but that will take awhile.
MongoDB is one of the most popular of the NoSQL databases.
- MongoDB
- Install MongoDB on Ubuntu
- Perl driver: MongoDB
- Perl driver: Mango
- GUI tool: Robomongo
Import Export Tools
Dump all, dump all on host, dump a db, dump a collection in a db (dumps to a directory called dump):
mongodump
mongodump --host my.dbhost.com
mongodump --db mydb
mongodump --db mydb --collection mycollection
Restore all, restore a db but first drop collections:
mongorestore
mongorestore -d db_name --drop dump/db_name
User Administration
User administration has changed for version 2.6. Create users in the database that you want to store the user information within by using the db.createUser() command. You can view the users stored in a database with "show users." The actual data is stored in the admin database system.users collection rather than in the system.users collection of the db it is created under.
db.createUser({ user: "name", pwd: "password", roles: [{ role: "readWrite", db: "db_name" }] })
Miscellaneous
Command line history for the mongo client ~.dbshell.
Experience a journal file corruption. This link helped.
Tags: Databases, Open Source