Introduction
Data modeling is one of the most important decisions you make when building applications on a document database. Unlike relational databases where you normalize data into tables and join at query time, Azure DocumentDB stores data in flexible BSON (Binary JSON) documents with over 99% MongoDB Query Language compatibility. That means the same data modeling patterns, operators, and aggregation stages you use in MongoDB work in Azure DocumentDB. The way you structure those documents, specifically what you embed together and what you store separately, directly affects your application's query performance, storage efficiency, and data consistency.
Suppose your e-commerce company provisioned an Azure DocumentDB cluster and your development team built the product catalog using basic CRUD operations. Now the team needs to model the relationships between customers, products, orders, reviews, and categories. Should order items live inside the order document or in a separate collection? Should product reviews be embedded with the product or referenced by ID? Each decision depends on how your application accesses the data, how many related items exist, and how often those items change.
In this module, you learn how to identify entity relationships and analyze their cardinality, apply the embed-vs-reference decision framework to determine the best modeling strategy. With this strategy, you learn how to implement one-to-one, one-to-many, and many-to-many relationship patterns using practical e-commerce examples.
By the end of this module, you're able to analyze data relationships and choose the right modeling strategy for each relationship in your Azure DocumentDB application.