Backup & Restore Data
With these commands, entire database instances as well as individual collections can be backed up and restored correctly. There are several options for the level at which this can be done.
Backup
mongodump --host="<yourmognodbinstance>:<yourmongodbport>" --port=<yourmongodbport> -o "<youroutputpatchforbackupfiles>"
Restore
Import data to Collection
mongorestore -d <yourdatabasename> -c <yourcollectionname> <yourpathtosinglebsonfile>
Restore single Collection
mongorestore --drop -d <yourdatabasename> -c <yourcollectionname> "<yourpathtosinglebsonfile>"
Restore complete Database
mongorestore -d <yourdatabasename> "<yourpathtodatabasebackupfolder>"
// SAME FOR WINDOWS
.\mongorestore.exe --uri "mongodb://127.0.0.1:27017" -d <yourdatabasename> "<yourpathtodatabasebackupfolder>"