Last active
January 4, 2018 19:24
-
-
Save jayjariwala/5fdabef00c0fb0d187a1405c1d4c29a8 to your computer and use it in GitHub Desktop.
Mongodb Import and export commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Import into database | |
sudo mongoimport --db newdb --collection restaurants --file primer-dataset.json | |
#export database collection | |
sudo mongoexport --db newdb -c restaurants --out newdbexport.json | |
# Take backup | |
create a folder regular backup folder | |
sudo mkdir /var/backups/mongobackups | |
Backup of the database | |
sudo mongodump --db newdb --out /var/backups/mongobackups/`date +"%m-%d-%y"` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment