All we need is an easy explanation of the problem, so here it is.
I have a datadump but I need to change the name of every database while restoring them,
if a database is named "customers" it needs to be "customer2", "products" to "products2"
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="PetHouse.*" dump/
how to I rename all database in a dump?
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
Should be this one:
mongorestore --nsInclude="PetHotel.*" --nsFrom='PetHotel.*' --nsTo='PetHouse.*' dump/ mongorestore --nsInclude='*.*' --nsFrom='$database$.*' --nsTo='$database$2.*' dump/
First test it with option
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂