Thursday, October 15, 2015

backup restore transfer MongoDB

1)  create folder dump at c:drive

2)run command

C:\Program Files\MongoDB\Server\3.0\bin>mongodump --out c:\dump\


3)transfer dump folder to server


4) bin> mongorestore --drop   [drop all other db before restore]

5) bin>mongorestore --dir c:\dump\

---------------------------------------------------------

mongorestore
The final argument of the mongorestore command is a directory path. This argument specifies the location of the database dump from which to restore.
You cannot specify both the  argument and the --dir option, which also specifies the dump directory, to mongorestore.
mongorestore  
--dir string
Specifies the dump directory.
You cannot specify both the --dir option and the  argument, which also specifies the dump directory, to mongorestore.
-----------------------------------------------



http://www.c-sharpcorner.com/UploadFile/f0b2ed/mongodb-day-17-backup-and-restore/




------------------------------------------------------------------------------------------------------
Backup command:

mongodump –db {Database name}

mongodump --db blog

Running the command will create a directory named dump
--------------------------------------
Restore command
mongorestore directory/database
mongorestore dump/blog

Restore

No comments: