This email and any files transmitted with it are considered privileged and confidential unless otherwise explicitly stated otherwise. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. All email data and contents may be monitored to ensure that their use is authorized, for management of the system, to facilitate protection against unauthorized use, and to verify security procedures, survivability and operational security. Under no circumstance should the user of this email have an expectation of privacy for this correspondence.
Got any suggestions what I’m doing wrong?
Hi Mike,
When you created a data export using mongodump the output (default) would be in a directory structure as below :
dump/
database1/
collection1.bson
collection1.metadata.json
collection2.bson
collection2.metadata.json
...
database2/
collection3.bson
collection3.metadata.json
collection4.bson
collection5.metadata.json
...
...
Then, you can restore using mongorestore‘s option —nsInclude to specify which collections to restore. For example, by executing below:
mongorestore -v --nsInclude "database1.*" --drop dump/
The nsInclude statement specifies to only restore content in the database1 database. For your use case, that would be --nsInclude 'TargetDb1.*'.
See also Restore Collection Using Wild Cards
Regards,
Wan