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.…

JavaScript Callbacks vs Promises vs Async Await

Javascript Callbacks vs Promises vs Async Await

JavaScript is a powerful programming language with its ability for closure, first class functions, and many other features. JavaScript is often used for Asynchronous Programming, or programming in a style that uses callbacks. While powerful, this can lead to what many now refer to as Callback Hell. Callback hell is also affectionately referred to as the Pyramid Of Doom thanks to the many levels of indentation which make your code look like a difficult to read pyramid.…

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.…