
Mongodb Schema Design
MongoDB performance problems usually trace back to schema design, not queries or indexes. This skill helps you decide between embedding and referencing data, avoid common anti-patterns like unnecessary collections and excessive lookups, and apply proven patterns like bucketing for time series or the extended reference pattern for caching frequently accessed fields. It's especially useful when migrating from SQL where the instinct to normalize everything will hurt you, or when you're hitting the 16MB document limit from unbounded arrays. The core principle is simple: data accessed together should be stored together. If you're doing a lot of lookups or your queries span multiple collections, your schema probably needs rethinking.
- skills.sh installs
- 7.2K
- GitHub stars
- 197
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mongodb/agent-skills --skill mongodb-schema-design --agent claude-codeInstalls into .claude/skills of the current project.
Files
MongoDB Schema Design
Data modeling patterns and anti-patterns for MongoDB, maintained by MongoDB. Bad schema is the root cause of most MongoDB performance and cost issues—queries and indexes cannot fix a fundamentally wrong model.
When to Apply
Reference these guidelines when:
- Designing a new MongoDB schema from scratch
- Migrating from SQL/relational databases to MongoDB
- Reviewing existing data models for performance issues
- Troubleshooting slow queries or growing document sizes
- Deciding between embedding and referencing
- Modeling relationships (one-to-one, one-to-many, many-to-many)
- Implementing tree/hierarchical structures
- Seeing Atlas Schema Suggestions or Performance Advisor warnings
- Hitting the 16MB document limit
- Adding schema validation to existing collections
Quick Reference
1. Schema Anti-Patterns - 3 rules
Sponsors
Details
- Repository
- github.com/mongodb/agent-skills
- Categories
- Git & Pull Requests, Code Review & Quality, AI & Agent Building, Debugging, Marketing & SEO, Design & UI/UX, Databases
- First seen
- May 16, 2026