
Skill
documentdb-data-modeling
design Azure DocumentDB data models
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.
SKILL.md
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 — Embed data accessed together; reference unbounded N-sides.
- model-16mb-limit — Stay well under the 16 MB BSON document limit; plan for steady-state growth.
- model-denormalize-reads — Denormalize for read-heavy workloads; pre-compute aggregates to avoid
$lookup. - model-schema-versioning — Add a
schemaVersionfield and migrate documents lazily.
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.
More skills from the documentdb-agent-kit repository
View all 17 skillsdocumentdb-azure-deployment
deploy Azure DocumentDB clusters
Jul 12AzureBicepCLIDatabase +2documentdb-connection
configure MongoDB connections for DocumentDB
Jul 12AzureDatabasePerformancedocumentdb-driver
implement Azure DocumentDB driver best practices
Jul 12AzureDatabaseMongoDBSDKdocumentdb-full-text-search
implement full-text search in Azure DocumentDB
Jul 15AzureDatabaseSearchdocumentdb-high-availability
configure high availability for DocumentDB
Jul 12AzureDatabaseOperationsPerformancedocumentdb-indexing
select and shape Azure DocumentDB indexes
Jul 12AzureCosmos DBDatabaseNoSQL
More from Azure (Microsoft)
View publisherazure-arg-external-evaluation-policy-author
author and test Azure Resource Graph policies
azure-policy
Jul 12AzureComplianceGovernancePolicyazure-blueprints-migration
migrate Azure Blueprints to Template Specs
azure-blueprints
Jul 12AzureDeploymentInfrastructure as CodeMigrationapiview-feedback-resolution
resolve APIView feedback on Azure SDKs
azure-sdk-tools
Jul 12API DevelopmentAzureCode ReviewDocumentationazsdk-common-live-and-recorded-tests
deploy resources and run Azure SDK tests
azure-sdk-tools
Jul 12AzureDeploymentSDKTestingazsdk-common-prepare-release-plan
manage Azure SDK release plan work items
azure-sdk-tools
Jul 12AzureGitHubProject ManagementSDKazsdk-common-sdk-release
release Azure SDK packages
azure-sdk-tools
Jul 12AzureCI/CDDeploymentSDK