Databases: MongoDB Introduction

For an introduction to Databases, and their role in webapps, see the article:

MongoDB on Atlas

MongoDB is a particular implementation of a NoSQL database. It creates a Database, which contains Collections, which contains Documents. These images should help you understand the structure a bit:

We'll use UCSD student and professor info to explain the above relationships. Documents simply hold information. Take a look in the image on the right. As you can see, the different Documents hold info about different students, which courses they're taking, etc. These student info Documents are all located within a Collection (let's name the collection "Student Collection"). Now, where do we store the professor info Documents? Definitely not in the Student Collection. Instead, we can make a second Collection to hold the professor info Documents, which we'll call the Professor Collection. These collections are what make up our MongoDB database.

Documents store data by holding a single JSON (JavaScript Object Notation) object. More about JSON can be found here.


There are multiple hosting providers that offer MongoDB implementations “in the cloud” as a service. The particular one we'll be using for SPIS 2020 is MongoDB's Atlas (the official MongoDB host provider). We are using Atlas because:

  • there is free tier

  • using the free tier does not require entering a credit card

  • it's the official MongoDB host provider

Let’s get started

Click here to go to the article where we will walk you through the steps needed to implement a MongoDB database in your web app!

References