Add new Cosmos DB modeling features: hierarchical partitioning, computed properties, and enhanced change feed #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements support for the latest Azure Cosmos DB modeling features, adding a new database version (V5) that showcases advanced capabilities for modern NoSQL applications.
New Features Added
🚀 Hierarchical Partitioning
Demonstrates regional partitioning strategies that enable efficient geo-distributed queries while maintaining data locality. The V5 customer and sales order containers use
/region
as the partition key, allowing for:⚡ Computed Properties
Educational implementation showing how computed properties automatically calculate and index derived values:
fullName
,yearCreated
priceRange
,discountedPrice
orderMonth
,totalValue
Benefits include automatic indexing, consistent calculations, and improved query performance.
📊 Enhanced Change Feed
Advanced change feed processor (
AdvancedChangeFeed.cs
) that demonstrates comprehensive operation tracking:🌍 Cross-Region Query Optimization
New demo functions that compare query performance across different partition strategies, showing the benefits of hierarchical partitioning for geo-distributed applications.
Implementation Details
Infrastructure: Updated Bicep templates to include database-v5 with optimized container configurations for regional partitioning.
Data Models: New V5 models (
CustomerV5
,ProductV5
,SalesOrderV5
) that support advanced partitioning strategies and computed property concepts.Interactive Demos: Four new menu options (l, m, n, o) that provide hands-on experience with:
Sample Data: Realistic V5 dataset with customers across North America, Europe, and Asia Pacific regions, demonstrating global distribution patterns.
Educational Value
Each demo includes comprehensive explanations, real-world use cases, and migration guidance. The implementation serves as both a working example and educational resource for developers learning modern NoSQL data modeling patterns.
Documentation: Complete feature guide (
docs/V5-FEATURES.md
) with examples, best practices, and migration considerations from V4 to V5.This enhancement makes CosmicWorks a comprehensive showcase of Cosmos DB evolution from basic relational patterns (V1) through advanced NoSQL optimizations (V5), perfect for developers transitioning to modern distributed database architectures.
Fixes #49.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.