Skip to content

Subpartitioning: Adds APIs for public release and increase REST API version #3763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 21, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public ContainerProperties(string id, string partitionKeyPath)
/// Initializes a new instance of the <see cref="ContainerProperties"/> class for the Azure Cosmos DB service.
/// </summary>
/// <param name="id">The Id of the resource in the Azure Cosmos service.</param>
/// <param name="partitionKeyPaths">The path to the partition key. Example: /location</param>
/// <param name="partitionKeyPaths">The paths of a mulihashed partition key. Example: ["/state", "/city"]</param>
public ContainerProperties(string id, IReadOnlyList<string> partitionKeyPaths)
{
this.Id = id;
Expand Down Expand Up @@ -341,6 +341,11 @@ public string PartitionKeyPath
{
get
{
if (this.PartitionKey?.Kind == PartitionKind.MultiHash && this.PartitionKey?.Paths.Count > 1)
{
throw new NotImplementedException($"This MultiHash collection has more than 1 partition key path please use `PartitionKeyPaths`");
}

return this.PartitionKey?.Paths != null && this.PartitionKey.Paths.Count > 0 ? this.PartitionKey?.Paths[0] : null;
}
set
Expand All @@ -365,7 +370,7 @@ public string PartitionKeyPath
}

/// <summary>
/// JSON path used for containers partitioning
/// List of JSON paths used for containers with subpartitioning
/// </summary>
[JsonIgnore]
public IReadOnlyList<string> PartitionKeyPaths
Expand Down