looking at the nodejs node stack with nodejs / express and mongoose
What is considered the best solution?
(1) Creating a datamodel mongoose module, then working with model objects
(2) Creating a datalayer shell module that will use the mongoose model
Advantages for (1)
I really like OOP style classes, mongooses give me, add my own methods, my own setters and getters, I can add checks and event handlers and use the DataModel without overriding it in another module.
Advantages for (2)
I should be able to prototype a data layer with a simpler implementation (tests, etc.). or switch the database if necessary.
What do you think?
source
share