I found this link https://groups.google.com/g/mongodb-user/c/aNNNeKXBUho provided one answer worked for me. Basically the folder given needs to be the root dump folder (i.e. “dump”) and the --nsInclude=“dbname.*” expects a folder called “dbname” under the “dump”.

Example of local db transfer:

mongodump --host=localhost --port=51896 --db dbname --out dump

The above command dumps all collections from database “dbname” unning at localhost:51896 into a subfolder like dump/dbname

mongorestore --host=localhost --port=27017 --nsInclude=“dbname.*” dump

The above command restores all collections under dump/dbname into the same “dbname” database running at localhost:27017.

If you need to use a different database name, then you just need to rename the “dbname” subfolder under dump to match your new database name.

mv dump/dbname dump/mynewdbname
mongorestore --host=localhost --port=27017 --nsInclude=“mynewdbname.*” dump

Hope this helps someone.

2 Likes