Fundamentals of Mongoose for Node and MongoDB

Mongoose is an open-source Node.js package that provides object modeling and structure to application data being saved to MongoDB. In this course, developers will learn to incorporate schema, models, and validation into their applications.
Course info
Rating
(16)
Level
Intermediate
Updated
Nov 29, 2018
Duration
1h 56m
Table of contents
Description
Course info
Rating
(16)
Level
Intermediate
Updated
Nov 29, 2018
Duration
1h 56m
Description

Using Mongoose, an open-source Node.js package, you can learn to incorporate schema, models, and validation into your applications. In this course, Fundamentals of Mongoose for Node and MongoDB, you will learn a solid foundation upon which you can continue to build and become proficient developing applications which use Mongoose to communicate with MongoDB. First, you will learn to build a Mongoose schema and a model from that schema. Next, you will discover the relationship between a Mongoose model and a document instance of that model and how to query for data using a variety of helper methods and query conditions. Finally, you will explore how to make sure that data sent to the database is valid using built-in and custom validators. When you're finished with this course, you will have the skills and knowledge of mongoose.js needed to start building your own Express API services to save data to and retrieve data from MongoDB through Mongoose.

About the author
About the author

Mark Scott is an experienced software developer with more than fifteen years experience in IT. He is currently the Manager of Software Development for a small group of talented web developers.

More from the author
Moving Forward with Mongoose.js
Intermediate
1h 45m
Jul 18, 2017
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hello everyone, my name is Mark Scott, and welcome to my course, Fundamentals of Mongoose for Node and MongoDB. Mongoose continues to mature and add additional functionality and improvements with each version released. In fact, Mongoose is now in its fifth major version. In this course, we are going to lay a solid foundation upon which you can continue to build and become proficient developing applications which use Mongoose to communicate with MongoDB. Some of the major topics that we will cover include how to build a Mongoose schema and a model from that schema, the relationship between a Mongoose model and a document instance of that model, making sure that data sent to the database is valid using built-in and custom validators, and querying for data using a variety of helper methods and query conditions. By the end of the course, you will have a good understanding of Mongoose and will be ready to start building your own Express API services to save data to and retrieve data from MongoDB through Mongoose. I hope you'll join me on this journey to learn more about Mongoose. js with the Fundamentals of Mongoose for Node and MongoDB course at Pluralsight.

Setting up the Demo Application
Hi, my name is Mark Scott, and in this module, we will discuss and demonstrate what is needed to set up the demo application that we looked at in the previous module. Having the right software development tools can make a world of difference, so we will spend a little time in this module going over a few of the tools that you too may find helpful when developing the demo application. In the next clip, we will start looking at the frameworks and libraries we'll need for the API server project, as well as for the client or user interface project. At the foundation of both of these projects is Node. js. Next, the API server will be built using Express. js. This is also where we will be using Mongoose to communicate with our underlying MongoDB server. For the UI side of things, we'll be using Vue. js and Vuetify in material design framework for vue. js.

Setting up MongoDB
Hello, and welcome to this module on setting up MongoDB. This module introduces you to some of the various MongoDB hosting options that are available, both cloud based and local hosting, and what will be used throughout this course. MongoDB itself will not be deeply discussed as this is covered in other Pluralsight courses. Just search for MongoDB in the Pluralsight library, and you will find a number of good courses. One example is the Pluralsight course Introduction to MongoDB, and that course can be found at the URL listed here. Lastly, we will up our local MongoDB database and collections, as well as import some seed or sample data that will be useful as we develop our demo application together. Let's get started on that now.

Building the Mongoose Schema
Welcome back. In this module, we will start learning how to build a Mongoose schema. You'll also see that with Mongoose, everything start with a schema. We will discuss and look at an example of a simple Mongoose schema, as well as a more complex schema and discover what data types or schema types are allowed for use in Mongoose. And we'll start the next clip by comparing a traditional related database schema design against what that might look like as a Mongoose schema. Let's take a look at that next.

Building a Model
Welcome to this module on building a Mongoose model. In this module, we will take what was learned about laying out a Mongoose schema in the previous module and build our first model based on that schema. We will then discuss Mongoose documents and subdocuments and the relationship between these documents and MongoDB documents within a collection. In the demo, we will build out our standup meeting notes model, construct a document from that model, and save it to MongoDB.

Retrieve Data Using Queries
Welcome to this module on retrieving data from MongoDB using Mongoose queries. In the previous module, we saw how to save a document to MongoDB using the models save method. In this module, we will be looking at the various methods to retrieve and update document. We will start by looking at the model methods find, findById, findOne, and where. We will then examine some of the methods used to update and remove documents from a MongoDB collection.

Using Validation Middleware
Welcome to this module on Mongoose validation. This module will introduce the built-in validators we have available to us in Mongoose. We will then introduce the concept of middleware and the development of custom validators. Next, we will discuss how to handle errors produced by the validation process and how to provide friendly error messages back to the application user. Finally, we will polish off the Express API server side of the demo application by adding in custom validation and error handling.

Next Steps
Welcome to this module on finishing touches and next steps. We've gotten a lot of work done on the Express API server, and things have been tested successfully using Postman with the locally running instance of MongoDB. But at this stage of development, it's time to move the database to the cloud, or at least to an on-premise database server. In this module, we'll start by doing just that and migrate the demo application's MongoDB instance to a cloud hosted offering. To finish this course off, we will review the completed Vue. js client project and test that out against our newly migrated database. As mentioned earlier in the course, the focus here was on Mongoose, so not much time was devoted to the UI project. To wrap the course up, we'll look at some other resources and Pluralsight courses on Vue. js and other UI frameworks that you may wish to consider, as well as additional information on MongoDB.