Skip to content

Latest commit

 

History

History
 
 

task-004-mongorestore

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

mongorestore

Restoring the mongodump back into mongodb database

  • standalone-complete-host-1616062771.gzip includes the complete backup including all the databases.

  • --nsInclude include only these databases.

  • --drop drop the existing collections if exist

  • Ensuring we are

$ uri_complete=mongodb://username:[email protected]:27017/admin:27017/admin

$ mongorestore --uri=$uri_complete -v --gzip --archive=standalone-complete-host-1616062771.gzip --nsInclude="module-*" --nsInclude="cli*" --numInsertionWorkersPerCollection=15 --bypassDocumentValidation --drop --preserveUUID --convertLegacyIndexes

Restoring dump of single database

  • Note the protocol here is mongodb+srv
mongorestore --uri="mongodb+srv://<username>:<password>@<hostname>/<database-to-be-restored>?retryWrites=true&w=majority" --gzip --archive=filename.gzip --numInsertionWorkersPerCollection=15 --bypassDocumentValidation --drop --convertLegacyIndexes