Skip to content

.Net: [MEVD] Cosmos NoSQL provider work on keys, partition keys and point reads#13550

Merged
roji merged 4 commits intomicrosoft:mainfrom
roji:CosmosNoSqlCleanup
Feb 17, 2026
Merged

.Net: [MEVD] Cosmos NoSQL provider work on keys, partition keys and point reads#13550
roji merged 4 commits intomicrosoft:mainfrom
roji:CosmosNoSqlCleanup

Conversation

@roji
Copy link
Member

@roji roji commented Feb 14, 2026

This is a sizable cleanup/redo of large chunks of the Cosmos NoSQL provider; I've broken it down to three commits for easier reviewing.

  • Cosmos NoSQL collections can now have either string/Guid as their key, or CosmosNoSqlKey. In the former case, this configures the partition key to be the same as the string/Guid document key - this is a sensible default that's common (and encouraged) in Cosmos. All other scenarios require CosmosNoSqlKey:
    • A single partition key that isn't the document ID
    • A hierarchical partition key (more than one property)
    • No partition key (legacy/discouraged)
  • Note that CosmosNoSqlKey is only passed to GetAsync and DeleteAsync; on the user's .NET record type, the properties are there as usual (e.g. a string document Id property, an int partition key property). This introduces a discrepancy for the first time between the collection's TKey (CosmosNoSqlKey) and its actual key property on the .NET type (a string); this made some things trickier, but is the correct way to do things for composite key cases (we'd do the same if we implement composite keys for relational providers).
  • Added support for Cosmos hierarchical partition keys (2-3 properties instead of just one).
  • GetAsync no longer does a SQL query with a WHERE clause, but rather an efficient point read via ReadItem. The multiple-key overload does ReadManyItemsAsync, which again is far more efficient.
  • UpdateAsync and DeleteAsync now correctly supply the partition key in the call's request options, again making it much more efficient.
  • Various other cleanup and fixes all around.

@moonbox3 moonbox3 added the .NET Issue or Pull requests regarding .NET code label Feb 14, 2026
@github-actions github-actions bot changed the title [MEVD] Cosmos NoSQL provider work on keys, partition keys and point reads .Net: [MEVD] Cosmos NoSQL provider work on keys, partition keys and point reads Feb 14, 2026
@roji roji force-pushed the CosmosNoSqlCleanup branch from 218e974 to 479169b Compare February 14, 2026 18:18
@roji roji marked this pull request as ready for review February 14, 2026 18:39
@roji roji requested a review from a team as a code owner February 14, 2026 18:39
@roji roji marked this pull request as draft February 16, 2026 15:22
@roji roji marked this pull request as ready for review February 16, 2026 16:42
@roji roji added this pull request to the merge queue Feb 17, 2026
Merged via the queue into microsoft:main with commit 8513c2a Feb 17, 2026
18 checks passed
@roji roji deleted the CosmosNoSqlCleanup branch February 17, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants