0

I can read in Microsoft's documentation that certain characters are restricted form the resource id, but I can't find any similar documentation for the partition key. As of now, I have "/" in the name of my partition keys, but I'm a bit worried what could happen if the partition key is subject to the same restrictions as the id. Do anyone know if there are any restrictions to the partition key?

https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.resource.id?view=azure-dotnet

2 Answers2

0

but I'm a bit worried what could happen if the partition key is subject to the same restrictions as the id.

I searched a lot and could not find any documents related to the restrictions about cosmos db partition key. Based on my test,the "/" character could be applied in the partition key:

enter image description here

query:

enter image description here]

The "/" works for the first character of pk or a part of pk.Surely,you could contact with azure cosmos db team to verify my argument.

Jay Gong
  • 23,163
  • 2
  • 27
  • 32
  • Tanks for your answer, @JayGong. I already have the "/" character in my partition key, and not only as the first character. I'll take your advice and contact the Cosmos DB team, and post the response here :) – Lars Erik Realfsen Sep 10 '19 at 12:52
  • @LarsErikRealfsen Sure,waiting for your updates.Thx. – Jay Gong Sep 11 '19 at 01:14
0

Through trial and a lot of error reports, I discovered that

#(35),/(47),?(63),\(92)

characters(ASCII value) cannot be used in the Microsoft Azure Table / Cosmos DB Table 'RowKey' column. Ignoring the first 31 ASCII characters(control and whitespace), the other values up to 255 are OK.

If writing a dotnet standard library and can't use the framework4.8 'HttpServerUtility.UrlTokenEncode' use this code taken from the Microsoft Source or this aspnetMVC.HttpAbstractions project version.

If experimenting with the first 255 C# char values, ignore 133 because it is not actually an ellipses but NEL Unicode (\085) control character. It's a complex and funny history lesson.

OzBob
  • 4,227
  • 1
  • 39
  • 48