Skip to content

Instantly share code, notes, and snippets.

@myctw
Created September 23, 2021 03:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myctw/47d27e2774feedbca307e80ea444be3d to your computer and use it in GitHub Desktop.
Save myctw/47d27e2774feedbca307e80ea444be3d to your computer and use it in GitHub Desktop.
MongoDB import data script
#!/bin/bash
host=127.0.0.1
port=27017
authDB=admin
db=[YourDB]
user=root
pwd=[YourPassword]
source_folder="./MongoDBBackup/${db}/"
echo $collection
mongorestore --host $host --port $port -u $user -p $pwd --authenticationDatabase $authDB --db $db ${source_folder}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment