MongoDB Atlas cluster - restore all databases except one

Hello,
I have the following use case - I have a MongoDB Atlas Production cluster with 11 databases. I have to restore all but one databases on a DEV cluster. Is this possible? Can I restore selectively databases from one cluster to another?

Currently my actual scenario is:

  1. mongodump of the DEV database to keep
  2. cluster restore from PROD to DEV
  3. delete the database which is not required
  4. mongorestore of the DEV database in place of the deleted one

Regards
Veronika

Hi @vvpe ,
you have several ways in which you can do this type of operation, I’ll list the first two that come to mind:

  1. Restore the prod cluster snapshot in the dev cluster and drop the database you don’t need into dev. Restore from a Scheduled or On-Demand Snapshot - MongoDB Atlas
  2. Mongodump and mongorestore, adding the --nsExclude option in the mongorestore. mongorestore - MongoDB Database Tools

Best Regards

2 Likes

Hello Fabio,
Thanks for the answer, actually I’m using both of the methods, because the requirement is to keep 1 database in DEV and restore the rest from PROD to DEV.

I’m asked to automate this with pipelines using the mongo CLI. However I’m unable to do so, because I can automate a cluster restore snapshot (your first suggestion), but I don’t have the option to exclude one database.
The second option is correct, but with mongodump and mongorestore --nsExclude I’m generating a lot of traffic from Atlas to on prem (mongodump) and and this is not ok too.

Is there a way to restore excluding one database with “Restore from a Scheduled or On-Demand Snapshot - MongoDB Atlas”?

Regards
Veronika

Hi @vvpe,
There 's no way to exclude a database from restoring a snapshot. The easiest thing is to drop it after the restore.

Best Regards

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.