Skip to main content

MongoDB

First, Install Mongoose​

  npm i mongoose

Next head to MongoDB's website​

MongoDB

It should take you here.

MongoDB Landing

Sign In or Try For Free​

In the top right, there is both a Sign In and Try Free. If you have used MongoDB already, you can sign in. If this is your first time, you can try it for free.

MongoDB Landing

Go To Project Dropdown Menu In Top Left Corner​

You should see a projects dropdown menu in the top left corner under the word 'Atlas'. Click the dropdown menu.

MongoDB Landing

Click On Existing Project Or Create New Project​

If you have a list of projects, you can select one of them, or you can click on 'New Project' on the bottom right of the dropdown.

MongoDB Landing

Click Create Database​

If your project has an existing database, and needs a new one it will be here.

MongoDB Landing

If your project does not have an existing database, and needs a new one it will be here.

MongoDB Landing

Choose Database Tier​

This next step is choosing the database tier you want. If you need it to be free, choose the free tier shown below.

MongoDB Landing

Click On Create To Create Database​

To finally create the database, click the button with the word 'Create' inside it.

MongoDB Landing

Click On The Connect Button​

Now click the connect button to get the menu of ways to connect to the database.

MongoDB Landing

Click On Connect Your Application​

To get the connection string you need, select Connect To Application menu item.

MongoDB Landing

Finally, copy the connection string​

You will need the connection string inside one of the backend server methods to connect to your newly created database. It will look similar to below. You also will need to remember the name of your database that you choose.

mongodb+srv://yourChosenUsername:password@cluster0.3osdj5z.mongodb.net/databaseNameHere?retryWrites=true&w=majority

This connection string will be helpful for when you are going to set up the connection to the database in the backend of your website.​