Using MongoDB with Express Js

MongoDB is a NoSql database which is used to store a large volume of data. NoSql database not uses the tables and rows approach. In MongoDB the database is collection of documents, documents are collection of key-value pairs. Javascript developers will find it similar to a javascript object.

MongoDB database can perform all types of CRUD (Create, Read, Update, Delete) operations. We use a module called mongoose to connect to the MongoDB database.

In the above code, we have connected our project to the MongoDB database. After that we have created a schema, which defines the structure of the data going to be stored. Then we have created a model and exported that to use in the other parts of the application.

Form to create the user

Leave a Reply

Your email address will not be published. Required fields are marked *