The following post describes about how to take a backups database and restores. Database dump is very important as part of maintain database.

Backup Database: 

 #  mongodump --host=localhost --db linuxfaqdb --out /tmp/linuxfaqdb


or

Save your database at current date and time in tmp/ directory,


# mongodump --host=192.168.1.50 --db linuxfaqdb --out tmp/`date +"%Y_%m_%d__"`linuxfaqdb

....
....
2015-11-21T07:25:32.817-0500    writing linuxfaqdb.linuxfaq to linuxfaqdbdb/linuxfaqdb/linuxfaq.bson
2015-11-21T07:25:32.822-0500    writing linuxfaqdb.linuxfaq metadata to linuxfaqdbdb/linuxfaqdb/linuxfaq.metadata.json
2015-11-21T07:25:32.824-0500    done dumping linuxfaqdb.linuxfaq (3 documents)


Restore Database:

The following command to restore database into it.


# mongorestore --host=192.168.1.50 --db linuxfaqdb /root/2015_12_03__linuxfaqdb/linuxfaqdb


2015-12-03T07:19:29.556-0500    finished restoring linuxfaqdb.data (2 documents)
....
2015-12-03T07:19:38.237-0500    [###################.....]  linuxfaqdb.mydata  16.5 MB/19.8 MB  (83.2%)
2015-12-03T07:19:40.620-0500    restoring indexes for collection linuxfaqdb.mydata from metadata
2015-12-03T07:19:41.085-0500    finished restoring linuxfaqdb.mydata (84094 documents)
2015-12-03T07:19:41.085-0500    done

sh.enablesharedings("linuxfaqdb")
{ "ok": 1 }

Import Specific Table :

# mongoimport --db linuxfaqdb --collection topics --file /root/2015_12_03__linuxfaqdb/linuxfaqdb/topics.metadata.json 

2015-12-03T07:52:14.265-0500    connected to: localhost
2015-12-03T07:52:14.278-0500    imported 1 document