Skip to content

Instantly share code, notes, and snippets.

@shansana
Created October 18, 2023 10:21
Show Gist options
  • Save shansana/77721d64d95aebe34ecbc4de02a5805a to your computer and use it in GitHub Desktop.
Save shansana/77721d64d95aebe34ecbc4de02a5805a to your computer and use it in GitHub Desktop.
Mongo DB dump and restore database using srv/uri (Example Atlas)
# Replace URI, your_db_name and C:\somelocation with your values
mongodump --uri mongodb+srv://dbuser:xxxxxxxxx@cluster0.xxxxx.mongodb.net --authenticationDatabase admin --db your_db_name -o "C:\somelocation\your_db_name"
mongorestore --uri mongodb+srv://dbuser:xxxxxxxxx@cluster0.xxxxx.mongodb.net --authenticationDatabase admin --db your_restore_db_name "C:\somelocation\your_db_name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment