Table of contents
What is a Mongoose?
It is a kind of ODM (Object Document Model) that always helps to communicate from the back end to the database. It has simply established a connection, it makes your connection more efficient with a database.
e.g for javascript ➡️ we have reacted in the same way for MongoDB ➡️ mongoose to make our code simpler rather than choose a complex one like js
How data is passed to the database?
Do your thing, whatever you request from your web application directly goes into your database. So, the answer is no. the data does not go directly into a database, there is always a commercial logic between the two. Thus, business logic is what let me give, e.g. it helps to understand more easily.
e.g Let's say you go to the market to buy some kind of fruit, and you buy this food; tell me, do you do that? You came home and you flushed everything you bought in the toilet. Do you do that? No. What you do is simply cleans it, then you eat it, then you let the process happen, and then it goes at the end. As a consequence, the data is transmitted to your database in the same way.
e.g Have you ever noticed that if you are logged in somewhere, after a certain period of inactivity, it will automatically log you out? Even regarding passwords, the encryption process fell into the logic of business.
Wrapping up
That's it for now..! 🤗 I hope you have understood how database work with taking help of mongoose and executes the program underneath.