Skip to main content

documentdb-data-modeling

Data modeling patterns for Azure DocumentDB — embed vs reference, 16 MB document limit, denormalization for read-heavy workloads, schema versioning. Use when designing new schemas, reviewing existing data models, migrating from SQL, deciding between embedding and referencing, modeling one-to-one / one-to-many / many-to-many relationships, or troubleshooting document-size and query-performance problems that stem from the data model.

소스 정보

저장소
Azure/documentdb-agent-kit
최근 소스 활동
2026년 7월 31일 22:12
감지된 SKILL.md 언어
영어
스타
6
포크
12

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
6 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
documentdb-data-modeling
description
Data modeling patterns for Azure DocumentDB — embed vs reference, 16 MB document limit, denormalization for read-heavy workloads, schema versioning. Use when designing new schemas, reviewing existing data models, migrating from SQL, deciding between embedding and referencing, modeling one-to-one / one-to-many / many-to-many relationships, or troubleshooting document-size and query-performance problems that stem from the data model.
license
MIT
# Data Modeling — Azure DocumentDB Guiding principle: **"Data that is accessed together should be stored together."** Each rule follows the same shape — why it matters → incorrect example → correct example → references. ## Rules - [model-embed-vs-reference](model-embed-vs-reference.md) — Embed data accessed together; reference unbounded N-sides. - [model-16mb-limit](model-16mb-limit.md) — Stay well under the 16 MB BSON document limit; plan for steady-state growth. - [model-denormalize-reads](model-denormalize-reads.md) — Denormalize for read-heavy workloads; pre-compute aggregates to avoid `$lookup`. - [model-schema-versioning](model-schema-versioning.md) — Add a `schemaVersion` field and migrate documents lazily. - [model-large-field-split](model-large-field-split.md) — Split a large, low-compressibility field into a side collection keyed by `_id` to avoid the PostgreSQL TOAST detoast tax on scans. Companion tool: [`scripts/toast-split-advisor.sh`](../../scripts/toast-split-advisor.sh). ## Companion tool (analysis only) [`scripts/toast-split-advisor.sh`](../../scripts/toast-split-advisor.sh) measures heap vs TOAST bytes on a live local container and reports **where** a large field should be split out — it never moves data: ```bash bash scripts/toast-split-advisor.sh --db <name> [--json] ``` ## Decision framework | Relationship | Cardinality | Access pattern | Recommendation | |---|---|---|---| | One-to-One | 1:1 | Always together | Embed | | One-to-Few | 1:N (N < ~100) | Usually together | Embed array | | One-to-Many | 1:N (N > ~100) | Often separate | Reference | | Many-to-Many | M:N | Varies | Two-way reference or junction collection | See each rule file for the full reasoning and code examples.
GitHub에서 보기