Wiping and re-creating staging environment using mongodump & mongorestore

Hi All,

We have just started using MongoDB Atlas. We are currently in development stage and only have a few alpha/early users in production, so the data isn’t that huge. (~few hundreds of mb).

We would like to wipe our staging environment and copy data from production on a scheduled basis to have a consistent testing environment for our QA team.

We are considering an approach using mongodump to dump production data and copy to staging using mongorestore with dropping the existing database. To get around the scheduling part, We are considering if we can execute some scripts in our CICD setup or see if we can use, ‘MongoDB Realm Functions’ as triggers in the ‘MongoDB Atlas’.

Is this a viable approach? Is there any better way to do this?

I would like to hear thoughts of the community who have been the same path and share some wisdom from your experience.

Hi Subbu, if your cluster is M10+ then another option is to use Atlas Backup/Restore to periodically restore from your Prod env to your Stage env (this can be done through the Atlas API and Terraform provider for example).

Yes you can use scheduled Triggers to do this on a cron as well.

-Andrew

1 Like