Mongoose Validation Examples

Mongoose Validation Examples

Just like all other frameworks, Mongoose provides a way to validate data before you save that data to a database. Data validation is important to make sure that “bad” data does not get persisted in your application. A benefit of using Mongoose when inserting data into MongoDB is its built-in support for data schemas, and the automatic validation of data when it is persisted. You would not get this without Mongoose.…

Mongoose Crud Tutorial

Mongoose Crud Tutorial

In this tutorial we are going to use Mongoose in our Node.js and MongoDB environment to create, read, update, and delete documents from the database. We will cover connecting to MongoDB using Mongoose, explore MongoDB Schemas, and review Models in MongoDB. From there we’ll move on to saving a document, as well as querying documents using comparison and logical expressions. We’ll also see how to update documents using Mongoose both with the Query First and Update First approaches.…

Install MongoDB With Compass On Windows

install and configure mongodb

MongoDB is a database system that stores data in flexible, JSON based documents, which means fields can vary from document to document and data structures can be changed over time. This is quite different than how traditional relational databases work such as MySQL. The document model in Mongodb maps to the objects in the application code. This makes the data more seamless and easier to work with.…

Node.js Express Rest Api Tutorial

Nodejs Express Rest Api Tutorial

Let’s see how to build a simple REST api using Express to allow for all of the CRUD operations. REST is referring to Representational State Transfer. It is a convention for building HTTP services via a client and server architecture. In REST, the HTTP protocol is used to facilitate Create, Read, Update, and Delete of resources on the server. These operations can be referred to collectively as CRUD operations.…

Node Package Manager Tutorial

npm tutorial

This npm tutorial will focus on Node Package Manager, or NPM as it is commonly referred to. NPM serves two main functions. It is a command line tool for running all kinds of development tools and scripts, in addition to a registry of third party libraries. In fact, at the last count NPM has something like 650,000 software packages available! This means for any problem you are trying to solve with Node.js, there is likely a free package already created that you can leverage in your own project.…

Express.js Beginner Tutorial

Expressjs Beginner Tutorial

In this Express beginner tutorial, we can download and install Express.js to our system and see how to get a super basic skeleton application set up and configured. Thankfully, this is made pretty easy by the fact that there is a dedicated tool to create a new Express project automatically called Express Generator. Let’s take a look at how the complete beginner can get up and running with Express.js right away.…

Node.js Routes Tutorial

Nodejs Routes Tutorial

In our last Node.js tutorial, we learned how to render some very basic html to the screen. Of course an actual website or application will have many different html files to present to the user. Typically you will need some type of routing mechanism to handle this. In this episode, we’ll take a look at a routes example where a user can load different urls in the browser.…