Sunday 30 September 2018

How do you structure your project by components if you are using mongoose as your orm?

I was browsing through the node best practices guide, and came across this issue. In all of my projects, I have had my models tightly couple to mongoose. It says there that"The major principle should be keeping your DAL as a data-mapper that maps domain entities into DB and NOT owning the canonical application entities. In other words, you have the domain models, simple JS objects that are agnostic to any DB concerns, which are the heart of the system - the DAL is responsible to serialize this model into DB. If you use ORM than that DAL will use its own internal models for the mapping. "I am a moderate expressjs developer and I am not sure how to do this using mongoose. Could someone help, if possible using code samples? Thanks in advance!

Submitted September 30, 2018 at 04:41PM by strawberrycandies

No comments:

Post a Comment