Docs Menu
Docs Home
/
MongoDB Manual
/

Schema Design Anti-Patterns

On this page

  • Get Started
  • Details
  • Learn More

Schema design anti-patterns are inefficient ways to structure your database schema. They can create unnecessary complexity and cause performance issues. Recognizing and avoiding schema design anti-patterns can help create applications with better performance.

To learn more about schema design anti-patterns, see the following pages:

Schema Design Anti-Pattern
Definition
Avoid Unbounded Arrays
A document stores an unbounded array that can grow to be too large. The large array can exceed the document size limit and cause a decrease in index performance.
You create a large number of collections in your database. Having too many collections can decrease storage engine performance.
Your collection contains unnecessary indexes. Unnecessary indexes consume additional disk space and can degrade write performance.
Your collection has excessively large documents. The large documents can degrade the performance of your most common queries.
You are running too many $lookup operations on your data. This increases query complexity and reduces query performance.

The MongoDB Atlas Performance Advisor (available for M10 clusters or higher) and MongoDB Compass Performance Insights identify schema design anti-patterns in your database. It is important to understand the Atlas anti-pattern warnings in order to properly correct the issues and prevent the use of anti-patterns.

For recommended schema design patterns, see the following: Schema Design Patterns and Apply Design Patterns.

Back

Maintain Versions