2
votes

If I store documents without providing partition key, In this case documentId will be treated as Partition Key of Logical Partition?

If yes: how about Billion logical partitions in that collection? I have query to only look by documentId.

Now inside Document JSON:
I have multiple fields & I have provided /asset as the partitionKey. Is this a composite partition key now: /asset/documentId? or /asset will tel partition to search for documentId from?

enter image description here

2

2 Answers

2
votes

If I store documents without providing partition key, In this case documentId will be treated as Partition Key of Logical Partition?

No. If you create a document without Partition Key, document id will not be treated as the partition key. Cosmos DB engine will put all the documents without a partition key value in a hidden logical partition. This particular partition can be accessed by specifying partition key as {}.

1
votes

You define the partition key when you create the collection (according to the screenshot asset is a partition key in your case). If you dont provide a partition key when you create a collection - it will be limited to 10 GB of data (because it wouldn't be able to shard it without partition key).

Only partition key is used to determine the partition of the document. other fields are irrelevant when deciding which partition this document belongs to.