Question - When should we normalize the data in MongoDB?
Answer -
It relies on our objectives. Normalization provides an updated effective data representation. Denormalisation makes data reading effective. Generally, we utilize embedded data models when:
- When we have “contains” relationships between the entities.
- When we have one-to-many relationships between the entities. In the relationships, “many” or the child documents display in the context of the parent documents.
Generally, we use normalized data models:
- When embedding results in duplication of the data yet they will not give enough read performance advantages to prevail the duplication implications.
- For representing more difficult many-to-many relationships.
- For modeling the big hierarchical data sets.