Another good thing about using Mongoose is that you clearly define your models (including default values, validation, etc.) in your application, which provide a lot of internal documentation for your application and significantly reduce the chance of inconsistencies when you have dealing with a relatively unstructured data model.
Relational databases have many functions for defining data types, default values, indexes, etc. and will cause errors if you (for example) try to use a column that does not exist.
Mongo removes a lot of overhead, but does more work, ensuring that a consistent data model is documented and maintained in the implementation code; Mongoose makes this a lot easier.
It also has many useful features to keep your models in check, including the ability to use strict schemes (the default version is v3), which means that any values ββthat you have not yet defined are not written to the database, " virtual fields ", which, for example, could combine the first and last name into a string, as if they were stored in a database (but this is not necessary) and index management. See the manual for more details.
source share