📄️ What is MongoDB Atlas
So far, the focus has been on local setup. The containers were all running locally, and it was easy to use. However, there will come a point where you will most likely want to connect to a database that is shared with your colleagues. Or you will most likely want to connect to a reliable, scalable, and resilient database once you launch your application into production. This is where MongoDB Atlas will come into play.
📄️ Create a MongoDB Atlas cluster
Once you are logged into your account, follow the steps from the documentation to create your free cluster. Once your cluster is up and running, you will be able to create your entites collection needed for your backend.
📄️ Set up the backend to use Atlas
Now's the time to change your application to use the cloud database rather than the local container version. The process is fairly straightforward since the application uses an environment variable to specify the connection string.
📄️ Revisit the docker compose file (optional)
If you created a Docker Compose setup earlier, and want to tweak it to use the new cloud database, you can use the following yaml.