DEV Community

Cover image for Day:37 Training at Ryaz          : Mongoose-modeling relationship b/w connected data
mahin651
mahin651

Posted on

Day:37 Training at Ryaz : Mongoose-modeling relationship b/w connected data

  • Date:4/02/2022
  • Day:Friday

Today I started at about 10:30 am as I was finished with seventh module so, I started with eighth module as it was about mongoose: modeling relationships between connected data so, I started with it firstly the instructor taught about model relationships between connected data, we can either reference a document or embed it in another document.so, we have these two options but,When referencing a document, there is really no relationship between these two documents. So, it is possible to reference a non-existing document.Referencing documents is a good approach when we want to enforce data consistency. Because there will be a single instance of an object in the database. But this approach has a negative impact on the performance of your queries because in MongoDB we cannot JOIN documents as we do in relational databases. So, to get a complete representation of a document with its related documents, we need to send multiple queries to the database.But Embedding documents solves this issue.And after this instructor taught about how to reference document and also discussed about implementations transaction with fawn. so, this way my day ended up and I got to learn many new things which enhanced my knowledge.

Top comments (0)