1
votes

I have an object which I insert into documentDB. This object has two string properties of 4000 chars each.

If I choose the object's own id as the partition key I will never reach the 10GB limit but each partition will be only a few kb in size and will contain only one object.

I have other types of objects in the same collection. If I create a DocType property for each different object type in the collection and choose that as the partition key all the objects with the DocType of the object with the big properties mentioned above it will reach the size limit of their own partition.

1
IMHO, it would help if you can edit your question and include sample documents containing your object there.Gaurav Mantri
Gaurav, it's just an object with two long properties, both contain a string with 4000 chars. If i will paste a sample here it will take a lot of screen space...SimpleDesign
I'm a bit confused about your data model: It's just an id and two (very large) strings? Does that mean you never run queries against the string fields? If that's the case, I'm not quite sure why you're trying to store in a document. In any case: this question really can't be answered by anyone here; a partition key is going to be specific to your data, and you don't have any metadata other than an ID right now.David Makogon
Thanks for helping David, other than the two big properties there is a customer name property, the id, and the order of the text in a big "story". the text is a chunk of a bigger whole or a "story" if you will. so there is also a property which says what is the order of the chunk, so I can put all the chunks together to form the initial "story".SimpleDesign
At the risk of oversimplification, your first option (id as partition key) is generally a better choice. Keep in mind that Azure Cosmos DB will not create physical partitions for each key, instead keep keys within the same partition until it reaches the capacity. What is your concern with that approach?Aravind Krishna R.

1 Answers

2
votes

Thanks to Aravind's comment I have found the solution which I can use, and it's the ID of the object. This is what Aravind said: "Keep in mind that Azure Cosmos DB will not create physical partitions for each key, instead keep keys within the same partition until it reaches the capacity." Thank you very much Aravind for solving my problem! (-: Have a wonderful day!