Created
December 1, 2016 17:07
-
-
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
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
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