Skip to main content
Anti Patterns
Unbounded Arrays
- an array without a size limit
- used subset pattern or extended reference pattern
Bloated Docments
- A document that groups together related data that is accessed separately
- say a book store has two pages: home and detailed page. Home shows 10 most popular books, each book displays title and author info. Detail page shows more data for the book, description, SKU, reviews, etc.
- if we use one collection to store the book details, and use that collection for the home page, it's bloated because home page only need title and author.
- a better design would be to create another collection to store title and author only. and the original collection can be used for the detailed page.
- yes it creates data duplicates, but again, it's a trade-off between duplicate data and performance.