Hello everyone,
I am working on a Node.js/Express/Mongo app.
I have 2 environments :
-
production environment, which connects to a ‘production’ Mongo database
-
development environment, which connects to a ‘development’ Mongo database
Both databases ‘production’ and ‘development’ are hosted in Mongo Cloud Atlas.
Note : today, the two databases are in the very same cluster, but I could create a second cluster if needed to solve my issue.
I regularly have to fix bugs, and every time it happens, I want to copy the data in the production database to the development database, so that I can replicate in my dev environment the issue viewed in production.
My question is : how can I copy the production database to the dev database (replacing data in the dev database) in the fastest way possible ?
Today, I am exporting/importing (via JSON file) the collection one by one, which is obviously not satisfying.
I also managed to write a script that I run on Mongo Playground in VSCode.
But I have a lot of collections, some of them are a bit “fat”, so the script is extremely long (=> not an acceptable solution).
I suppose I am running through a very common problem, and that there should be a standard solution here.
How should I manage this ?