The User Model

Let’s apply what we've learned about MongoDB to create the user model.

We'll cover the following

Let’s begin writing the most important model in our project, which is the user model. The user is anyone who wants to use our application features. To provide the user with a better experience, we need our application to know and memorize a set of data about the user. Depending on that data, we can introduce a large set of features for the users.

For example, we can’t implement the login feature if we don’t have the username and password of the user. So, as a starting point, we need to set up the database.

Mongoose

From now on, we’ll use Mongoose to connect to and manipulate the database of the application. Mongoose is the client for the MongoDB driver in Node.js, which we can use to facilitate the communication between Node.js and MongoDB.

Get hands-on with 1200+ tech skills courses.