Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 991 Bytes

File metadata and controls

24 lines (15 loc) · 991 Bytes

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