3

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.js so as to access the data?. Like for CRUD 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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.