Setting up MongoDB

Every application needs a persistence layer. This lesson will show you how to enroll for free Atlas cloud MongoDB instance. You will also feed your database with data.

Setting up MongoDB#

Before you start coding the backend, you need a MongoDB instance where you will keep your application data.

There are a few ways to do this. You can either 1. install MongoDB on your local machine and test it that way or 2. use a cloud MongoDB instance.

In both cases, you will also need to fed your database with data. If you wish, you can use the same objects as I used. To do that, download the db_dump - you will import it into your DB during this lesson.

Setting up MongoDB locally#

Below, we're going to describe how to use a cloud MongoDB instance, but if you'd rather use a local installation, then the MongoDB docs are very good. For your convenience here are the relevant links, depending on your system:

Because local development environments vary so widely, we can't describe each scenario in detail. But if you follow the above instructions and run into trouble, join our Discord server and someone can probably help you out.

Provisioning a MongoDB Atlas cloud instance#

Once your application is ready, navigate to and sign in to your account. Then create a new cluster in a region that is closest to your default Heroku region:

When your cluster is ready, click the Connect button and follow the prompts in the Connect to Cluster panel to:

  1. Allow access from anywhere

  2. Create a MongoDB user


This page is a preview of The newline Guide to Angular Universal

No discussions yet