For my node.js app, I am using mongodb as the database. Also i prefer to use mongoose.js on top of it. My question is,
is it justifiable to build an additional layer on top of
mongoose.jsso as to access the data?. Like forCRUD operations?
like a generic function set which does exactly what mongoose does and limiting coders from writing directly mongoose queries and may be helping at a later stage when we change the db or mongoose. I am asking this because i cant see how much effective this will be at a later stage but seems annoying now. Please suggest.
Hard to answer definitively, but I tend to have this 'extra' layer for easier testability. E.g. easier to test classes/files in isolation. Also useful if you'd like to be able to refactor another data storage at some point.