Table of Contents

Class PartitionKey

Namespace
Microsoft.Azure.Documents
Assembly
Microsoft.Azure.Documents.Client.dll

Represents a partition key value that identifies the target partition of a collection in the Azure Cosmos DB service.

public sealed class PartitionKey
Inheritance
PartitionKey
Inherited Members
Extension Methods

Constructors

PartitionKey(object)

Instantiate a new instance of the PartitionKey object.

public PartitionKey(object keyValue)

Parameters

keyValue object

The value of the document property that is specified as the partition key when a collection is created.

Remarks

This class represents a partition key value that identifies the target partition of a collection in the Azure Cosmos DB service.

Fields

SystemKeyName

The tag name to use in the documents for specifying a partition key value when inserting such documents into a migrated collection

public const string SystemKeyName = "_partitionKey"

Field Value

string

SystemKeyPath

The partition key path in the collection definition for migrated collections

public const string SystemKeyPath = "/_partitionKey"

Field Value

string

Properties

None

Instantiates a new instance of the PartitionKey object.

public static PartitionKey None { get; }

Property Value

PartitionKey

Remarks

The returned object represents a partition key value that allows creating and accessing documents without a value for partition key

Methods

Equals(object)

Overrides the Equal operator for object comparisons between two instances of PartitionKey.

public override bool Equals(object other)

Parameters

other object

The object to compare with.

Returns

bool

True if two object instance are considered equal.

Remarks

This class represents a partition key value that identifies the target partition of a collection in the Azure Cosmos DB service.

FromJsonString(string)

Instantiate a new instance of the PartitionKey object.

public static PartitionKey FromJsonString(string keyValue)

Parameters

keyValue string

The value of the document property that is specified as the partition key when a collection is created, in serialized JSON form.

Returns

PartitionKey

Remarks

This class represents a partition key value that identifies the target partition of a collection in the Azure Cosmos DB service.

GetHashCode()

Hash function to return the hash code for the object.

public override int GetHashCode()

Returns

int

The hash code for this PartitionKey instance

Remarks

This class represents a partition key value that identifies the target partition of a collection in the Azure Cosmos DB service.

ToString()

Override the base ToString method to output the value of each key component, separated by a space.

public override string ToString()

Returns

string

The string representation of all the key component values.

Remarks

This class represents a partition key value that identifies the target partition of a collection in the Azure Cosmos DB service.