Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers MongoDB schema design patterns and anti-patterns, including embed-vs-reference decisions, unbounded arrays, and schema validation.
70% 87%+17 ptsof test cases passed
Passed 20 of 23 test cases with the skill, and 16 of 23 without it.
3 of 3 safety checks passed
16 agent runs
This is one of the most important schema decisions you'll make. Choose embedding or referencing based on access patterns, not just entity relationships.
Embed when:
Reference when:
Decision Matrix:
| Relationship | Cardinality | Access Pattern | Bounded? | Decision |
|---|---|---|---|---|
| User → Profile | 1:1 | Always together | Yes | Embed |
| User → Addresses | 1:few (1-5) | Usually together | Yes | Embed array |
| Order → Line Items | 1:few (1-50) | Always together | Yes | Embed array |
| Publisher → Books | 1:many (1000+) | Often separate | No | Reference |
| Post → Comments | 1:many (unbounded) | Separate adds | No | Reference |
| Students ↔ Classes | Many-to-many | Both directions | Moderate | Reference both ways |
| Product ↔ Category | Many-to-many | Either way | Moderate | Embed refs in primary direction |
Embed one-to-one related data directly in the parent when it is consistently co-accessed. Keeping it in one document eliminates a round-trip and guarantees atomicity.
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.