I created a new web app with mongodb

In the process of learning mongodb , react and much more, I created a full-stack application using next js and was really wondering whether it is really necessary to use
mongoose models has most of the tutorials follows that, whereas I have used just mongodb querries. Check out my github repo for project details
harisankar01/article-app: a next js app about writing articles and submitting them for review (github.com)

1 Like

I personally try to avoid abstraction mid-layers like mongoose, react, …

I rather have a deep understand of the underlying technology.

Sometimes, the abstraction layer become an obstruction layer, that stops you from doing something that the underlying technology allows.

It is an opinion.

1 Like

How can I get a whole view on this concept in my project?

There is nothing to say here except

1 Like

Welcome to the MongoDB Community @hari_sankar1!

Can you provide some more detail on the information or advice you are looking for?

Mongoose (or another Object-Document Mapper abstraction aka ODM) is not strictly required to use MongoDB, and there are definitely considerations around performance, flexibility, and additional layers of abstraction.

ODMs generally trade performance (versus using the underlying MongoDB driver) for developer productivity. For example, Mongoose has features like model validation and middleware, but these convenience features add memory and application processing overhead.

The Mongoose documentation warns about this and provides Lean Methods which might be useful:

Mongoose documents are much heavier than vanilla JavaScript objects, because they have a lot of internal state for change tracking. Enabling the lean option tells Mongoose to skip instantiating a full Mongoose document and just give you the POJO.

However, if you find yourself frequently relying on lean methods to get acceptable performance, your application would likely benefit from using the MongoDB Node.js driver directly.

For a general comparison, see MongoDB & Mongoose: Compatibility and Comparison | MongoDB.

Regards,
Stennie

2 Likes