kumar
kumar

Reputation: 9427

Azure Cosmos what happens if partition key value is null

In Azure Cosmos I have selected partition key as City. But it is possible that this key can have a null also. In such a case. Will all the City with null be in one partition.

How will the partition be distributed in this case?

Upvotes: 2

Views: 2734

Answers (2)

Sajeetharan
Sajeetharan

Reputation: 222720

You can create. Null, Undefined, and empty string are treated as different values in Cosmos DB.

new RequestOptions { PartitionKey = new PartitionKey(null) }

As 4c74356b41 mentioned There will be a separate partition and these values will go under that.

Upvotes: 1

4c74356b41
4c74356b41

Reputation: 72211

Fairly certain there is a hidden partition and all the documents without a partition key would go to that partition.

I recall reading this somewhere on SO answers\comments.

Upvotes: 1

Related Questions