I've overlooked that when I have created the container
this.Container = await this.Database.CreateContainerIfNotExistsAsync("testContainer", "/id");
I have specified partitionKeyPath
as beeing the /id
.
It also seems that the partition key must reside on the object and must have a json property of partitionKeyPath property name without / like:
[JsonProperty(PropertyName = "partition")]
public string Partition { get; set; }
if partitionKeyPath
is /partition
this.Container = await this.Database.CreateContainerIfNotExistsAsync("testContainer", "/partition");
Sorry if this is obvious, I have just started playing around with CosmoDb.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…