MongoDB Atlas is a fully-managed cloud database developed by the same people that built MongoDB. Atlas handles all the complexity of deploying, managing, and healing your deployments on the cloud service provider of your choice (AWS, Azure, and GCP). Follow the links below to get started.
https://www.mongodb.com/cloud/atlas
- at the moment, free tier cluster is not available in Australia. The nearest free one should be Singapore, so I recommend selecting Singapore(ap-southeast-1)
- give your cluster a name and hit the create cluster button.
- copy the link and in your express app, add this link instead of the local mongodb link. Replace the
<password>
bit with your database user password.
- connect your application:
const mongoPROD_URI ="mongodb+srv://username:yourpassword@cluster0-nzlan.mongodb.net/test?retryWrites=true&w=majority" mongoose.connect(mongoPROD_URI, { useNewUrlParser: true }, (err) => { if(err) return console.log(`${err}`) console.log("connected to mongodb") })