MongoDB

Administration

Run MongoDB server

./mongod --dbpath ../data/db --port 27666

Run MongoDB client

./mongo --port 27666

Export all collections of a database

./mongodump -d uploads_pol_west -o backup/

Optional :

  • --port 27666

Re-import exported collections

./mongorestore -d uploads_pol_west backup/uploads_pol_west/

Optional :

  • --port 27666

Usage

Get MongoDB version

db.version()

List and use a database

show databases
use uploads_pol_west

List collections and show their content

show collections
db.collectionName.find()
Print/export