How much overhead does Mongoose add to the node-mongodb-native driver? If I just wanted to have a couple structurally similar queries on several collections, would it make more sense to just write everything using the driver directly? For example, I would need to do something as follows (in the driver language, as copied from here):
db.collection('test', function(err, collection) {
collection.find({'a':1}, function(err, cursor) {
*do something*
}
}
Where I would just replace 'test' and 'a' with variables to hold the actual collection and key that I’m looking for.
I feel like it makes sense in this case to just write everything using the driver directly. Would there be any reason to use Mongoose itself? Is the overhead so negligible that I’m being silly by considering using the driver directly?
Best, and thanks,
Sami
Depends how large your app is going to be. If you’re only doing a few queries it’s probably not worth adding Mongoose to the mix but once your app starts to grow Mongoose can help keep it more maintainable. Dev time is usually more valuable than processing time.
Unless your app is going to be serving a LOT of simultaneous requests you probably won’t notice the difference in performance.