Help understanding Environments

I want to have two enviroments(with separated emails, separated data), called DEV and PROD. Using the Realm GUI I can see that there is a setting for environments that is basically different context values and settings. But I’m not getting what is the purpose of those settings because in the client side I don’t see any configuration setting during the app setup where I can set the environment I want to use:

const app = new Realm.App({ id: "<Your App ID>" });

So, If I want to have those two environments do I actually need to create Two applications in realm with basically all the json config duplicated(except the atlas links)? I’m getting this right?

Second, If I have two variables configured in my app, let’s say dev email=‘testing@email.com’ and prod email=‘prod@email.com’.

What happens when I change the “Your Environment” in the Realm UI from TEST to PROD? Every function that use that variable will be using the new value instead? counting also all the customers connected to that particular application-id?

Does that means that once I start production the “Your environment” setting should never be touched again? Is that a “only in dev” setting? What could be a reason to change that value after deployment?

Hello Mariano_Cano,

Welcome to the MongoDB Forums!

Allow me to clarify some things:

  1. Yes, you need a test and a production app with Realm. So when you push your mobile or web, or desktop application using Realm you don’t accidentally break service to your production environment running a test.
  2. I would never encourage using your production environment as a test environment
  3. The e-mails are fine, however you want to be sure to follow JSON formatting.
  4. When you change from TEST to PROD you are just changing the app label for you and your team to understand which app is which.

Regards,

Brock