Closed chetanmeh closed 6 years ago
@chetanmeh thanks for reporting this. We have a fix for this, which should get released along some other improvements in a week or so. We are code complete, just final review, testing.
@moderakh Good to know that its under fix. Just to unblock myself for now would it be fine to just bump the limit locally assuming the limit for PartitionKey is >= 255 or there is more to this issue
@chetanmeh no. that won't work.
Thanks for confirming. Would then look for next release
addressed in 2.1.0.
added unit test: https://github.com/Azure/azure-cosmosdb-java/blob/master/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentCrudTest.java#L99-L115
@moderakh Should the test create key with length 255 as thats the max limit. So far keys upto 100 work as expected as that was the earlier limit in StringPartitionKeyComponent
Ignore the previous comment. Now see that test case was building with 2-3 chars per iteration. Also looks like 255 limit is only for id
. For partition key the limit looks much higher (probably 1 KB).
So it works fine now !!
StringPartitionKeyComponent
truncates the key to 100 chars.https://github.com/Azure/azure-cosmosdb-java/blob/17937b1d230ab78202cde3380dc8be83ff9cd43b/sdk/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponent.java#L34
Per docs the maximum length for
id
field is 255 chars. However I was not able to find any documented limit for partition key. Closest reference found here mentionsCan this limit in
StringPartitionKeyComponent
be set to 255 at least? Due to current truncation I get errorPartitionKey extracted from document doesn't match the one specified in the header
as theid
field in document being added has length say 120 chars while one passed in header is truncated to 100.