So my first reaction to your question was "huh, why would you not want to use Mongoose?" I am using Mongoose because it was recommended to me, and I never really looked into using MongoDB without it.
But then I looked at the MongoDB docs, and you are on to something! Compare the queries below:
I'd say they're both pretty readable. What I think is the answer to "should I use Mongoose or not" really depends on the app you're building. For simpler apps you don't need the extra abstraction layer that Mongoose adds. For more complex apps with complicated querying, using Mongoose probably makes your life a bit easier.
Personally I have decided not to use mongoose in projects where 80% of its extra features will not be used (schema, virtuals, pupulate, hooks, etc.).
And although it is not "so" important, the native driver is faster! The only thing is that we must manually configure the connection pool, although it is not difficult.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
So my first reaction to your question was "huh, why would you not want to use Mongoose?" I am using Mongoose because it was recommended to me, and I never really looked into using MongoDB without it.
But then I looked at the MongoDB docs, and you are on to something! Compare the queries below:
Using Mongoose:
Using pure Mongo:
I'd say they're both pretty readable. What I think is the answer to "should I use Mongoose or not" really depends on the app you're building. For simpler apps you don't need the extra abstraction layer that Mongoose adds. For more complex apps with complicated querying, using Mongoose probably makes your life a bit easier.
It's true, it depends on the application.
Personally I have decided not to use mongoose in projects where 80% of its extra features will not be used (schema, virtuals, pupulate, hooks, etc.).
And although it is not "so" important, the native driver is faster! The only thing is that we must manually configure the connection pool, although it is not difficult.