Hello, I have a question about the MongoDB configuration in Emergent.
Context:
I have a deployed application (FastAPI + React + MongoDB) and I need to have separate databases for the Preview and Production environments so I can run development tests without affecting production data.
What I tried:
I set DB_NAME=database_prod in Emergent Env Variables (for production)
I left DB_NAME=test_database in the local .env file (for preview)
I used load_dotenv(override=False) so that the Env Variables take priority
The problem:
I found that both Preview and Production share the same MongoDB cluster. The localhost:27017 in Preview seems to redirect to the same MongoDB in the cloud. Therefore, any change in Preview affects Production and vice versa.
My questions:
Is it possible to have completely separate databases for Preview and Production?
If it’s not natively possible, what is the recommended solution to run tests without affecting production data?
Thanks.