MongoDB/mongodb-schema-design — Agent Skills | officialskills.sh
Back to skills

mongodb-schema-design

officialdata

A collection of MongoDB schema design patterns and anti-patterns from MongoDB, covering embed-vs-reference decisions, the 16MB document limit, schema validation, and 11 data modeling patterns like bucket, polymorphic, and time series.

Setup & Installation

npx skills add https://github.com/mongodb/agent-skills --skill mongodb-schema-design
or paste the link and ask your coding assistant to install it
https://github.com/mongodb/agent-skills/tree/main/skills/mongodb-schema-design
View on GitHub

What This Skill Does

A collection of MongoDB schema design patterns and anti-patterns from MongoDB, covering embed-vs-reference decisions, the 16MB document limit, schema validation, and 11 data modeling patterns like bucket, polymorphic, and time series. Includes a decision framework for relationships and optional MCP integration to inspect live collections.

Most MongoDB performance problems come from schema decisions, not query tuning, and this skill gives you the specific pattern names and trade-off tables MongoDB's own engineers use to diagnose them.

When to use it

  • Deciding whether to embed order line items or reference them from a separate collection
  • Migrating a normalized PostgreSQL users/profiles/addresses schema into document form
  • Fixing a products collection where documents keep approaching the 16MB cap
  • Bucketing IoT sensor readings into hourly documents instead of one-doc-per-reading
  • Adding $jsonSchema validation to a legacy collection with inconsistent field types