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.
Get Started
To learn more about schema design anti-patterns, see the following pages:
Schema Design Anti-Pattern | Definition |
---|---|
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. |
Details
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.
View Schema Suggestions in Performance Advisor
In Atlas, go to the Clusters page for your project.
WARNING: Navigation Improvements In Progress We're currently rolling out a new and improved navigation experience. If the following steps don't match your view in the Atlas UI, see the preview documentation.
If it's not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
If it's not already displayed, click Clusters in the sidebar.
The Clusters page displays.
Learn More
For recommended schema design patterns, see the following: Schema Design Patterns and Apply Design Patterns.