Search code examples
azureazure-cosmosdbpartitioning

How to partition data using multiple properties in Azure Cosmos DB


How to partition data using multiple properties in Azure Cosmos DB? I tried to check in the Azure documentation, but couldn't find a solution.

Can anyone please help me out here?


Solution

  • I want to partition data using multiple columns/properties. E.g. UserId and ProductId. Is it possible to do so?

    Currently it is not possible to partition a collection on multiple properties. You could create a composite key (e.g. UserProductId) that stores both user id and product id and use that for partitioning of data.