Skip to content

Instantly share code, notes, and snippets.

@klardotsh
Created December 1, 2016 17:07
Show Gist options
  • Save klardotsh/c45d2b26d1cd5a49fd0a88709a387086 to your computer and use it in GitHub Desktop.
Save klardotsh/c45d2b26d1cd5a49fd0a88709a387086 to your computer and use it in GitHub Desktop.
Restore multiple mongodb databases in one sweep, since mongorestore needs to be told db names to import to
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
find ./ -type d -exec basename {} \; | grep -v "\." | parallel mongorestore -d {} {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment