Denis
Denis

Reputation: 509

Mongorestore –gzip –archive restore only specific collection

I have MongoDB backup that was created in following way:

mongodump -h <host> -u <user> --password=<password> -d <db_name> --authenticationDatabase <db_name> --archive=<backup_name>.gz --gzip

When I’m restoring the backup using “mongorestore” all the DB content is being restored. I’m looking for a way to restore only specific collection from the backup to a new or same DB.

I’ve tried to use --nsInclude, --nsFrom and --nsTo flags, but they aren’t helping.

Is there any possible way to achieve what I’ve described above?


Upd:

I've tried following:

  1. as described in that post
  1. to use --nsInclude, --nsFrom and --nsTo
  2. In output I see that it's restoring all the collections and not one i specified in "--nsInclude=". I cannot share an output cause my MongoDB is running in air-gapped environment.

Upvotes: 0

Views: 51

Answers (0)

Related Questions