Mongo DB

Turbo 360

Mongo DB (the "M" in MEAN and MERN stack) is among the most dominant databases in use today. Along with MySQL and PostgreSQL, Mongo DB an industry-standard database consideration among startups and large companies alike. But unlike the other two, Mongo DB is the de-facto standard for document based databases and has exploded in popularity since its release in 2009. In this series, we implement a basic Mongo DB with Node/Express project and fully deploy it to the Turbo staging environment.


Installation

In this intro to the series, we review the main topics covered throughout the series and install the tools required to follow along: Node JS, Mongo DB, and the Turbo CLI.

Project Setup

In this video, we set up a Node & Express application then connect it to our local Mongo DB server.

Profile Schema

We define our Profile schema in this video using the Mongoose schema() function which provides useful tools to maintain data consistency throughout our Mongo DB.

Seed Data

In order to have some initial data to work with, we "seed" our Mongo DB with static JSON objects. Using the Mongo CLI, we import those objects into our database as records enabling us to query for objects using query filters.

Queries

Querying our Mongo DB can be done a number of ways in and this video, we cover the most common approaches.

ID Queries

Querying for records in our Mongo DB using filters is very useful but not always the most efficient. If we already know the unique ID of the record we need, we can query for it directly using that ID. In this video, we cover the Mongoose method for this situation.

Creating Data

Adding records to our Mongo DB is quick and easy using the Mongoose ORM. In this video, we set up a simple form which posts data to an endpoint we set up just for creating profiles and add a new record to our Mongo database from the web interface.

Updating Data

We set up a simple endpoint for updating records in our Mongo DB based in the unique ID and key-value pairs for the changed fields.

Removing Data

Removing data from a Mongo DB is as easy as updating with the Mongoose ORM. In this video, we set up a simple endpoint for removing records based on the unique ID.

Deployment

We cap off the series by deploying our Node/Express project to Turbo and our Mongo DB to the mLab service. We then test all the CRUD functions on our staging environment to confirm that the project behaves the same as it does on local.

Membership Options