Rename all databases when doing a mongorestore? I have a datadump but I need to change the name of every database while restoring them,
if a database is named &quot;customers&quot; it needs to be &quot;customer2&quot;, &quot;products&quot; to &quot;products2&quot;
I can rename an individual database but that will take a lot of time to rename each database separately
mongorestore --nsFrom='PetHotel.pets' --nsTo='PetHouse.pets' --nsInclude=&quot;PetHouse.*&quot; dump/
how to I rename all database in a dump?
Should be this one:
mongorestore --nsInclude=&quot;PetHotel.*&quot; --nsFrom='PetHotel.*' --nsTo='PetHouse.*' dump/

mongorestore --nsInclude='*.*' --nsFrom='$database$.*' --nsTo='$database$2.*' dump/

First test it with option --dryRun
See Change Collections' Namespaces during Restore