Anti-patterns (what not to do…)
There are several anti-patterns/wrong practices that should be avoided when working with NoSQL systems. Let’s review some obvious examples of what not to do.
Overusing or misusing denormalization
Overusing or misusing denormalization can lead to inconsistent or redundant data, making it difficult to maintain data integrity.
For example, consider a hypothetical e-commerce application that uses a NoSQL database to store order and product data. The database uses a denormalized data model, where each order document contains product information as embedded documents. However, the application team decides to denormalize further and embed order data within each product document as well, simplifying querying. This leads to redundant data and inconsistent order data, as changes to order data will need to be updated in multiple places.
Here’s an example of overusing denormalization in MongoDB:
JSON
// Example of overusing...