ChangeFeedMetadata.PartitionKey Property

Definition

Applicable for delete operations only, otherwise null. The partition key of the previous item version represented as a dictionary where the key is the partition key property name and the value is the partition key property value. All levels of hierarchy will be present if a hierarchical partition key (HPK) is used.

[Newtonsoft.Json.JsonProperty(NullValueHandling=Newtonsoft.Json.NullValueHandling.Ignore, PropertyName="partitionKey")]
[System.Text.Json.Serialization.JsonInclude]
[System.Text.Json.Serialization.JsonPropertyName("partitionKey")]
public System.Collections.Generic.Dictionary<string,object> PartitionKey { get; }
[<Newtonsoft.Json.JsonProperty(NullValueHandling=Newtonsoft.Json.NullValueHandling.Ignore, PropertyName="partitionKey")>]
[<System.Text.Json.Serialization.JsonInclude>]
[<System.Text.Json.Serialization.JsonPropertyName("partitionKey")>]
member this.PartitionKey : System.Collections.Generic.Dictionary<string, obj>
Public ReadOnly Property PartitionKey As Dictionary(Of String, Object)

Property Value

Attributes
Newtonsoft.Json.JsonPropertyAttribute JsonIncludeAttribute JsonPropertyNameAttribute

Remarks

For single partition key containers, the dictionary will contain one entry with the partition key path name (without the leading '/') as the key and the partition key value as the value.

For hierarchical partition key containers, the dictionary will contain multiple entries, one for each level of the hierarchy, as defined in the container's partition key definition.

Example for a single partition key container with partition key path "/tenantId":

{
    "tenantId": "tenant123"
}

Example for a hierarchical partition key container with partition key paths ["/tenantId", "/userId", "/sessionId"]:

{
    "tenantId": "tenant123",
    "userId": "user456",
    "sessionId": "session789"
}

The partition key values can be of different types (string, number, boolean, null) depending on the document's schema. For example, with partition key paths ["/category", "/priority"]:

{
    "category": "electronics",
    "priority": 1
}

Applies to