I'm trying to output data from an Azure function to CosmosDb (MongoDb), I have the following binding setup:
[DocumentDB("mydatabase", "mycollection",
ConnectionStringSetting = "CosmosDBConnection",
CreateIfNotExists= true,
PartitionKey = "SomeKey")]
IAsyncCollector<MyEntity> mongoBinding,
In my code I do the following:
var entity = new MyEntity() {SomeKey="X1CLX1010000002", Data = "somedata"};
await mongoBinding.AddAsync(entity);
public class MyEntity {
public string SomeKey {get; set;}
public string Data {get; set;}
}
Results in error:
{"Errors":["The partition key component definition path 'SomeKey' could not be accepted, failed near position '0'. Partition key paths must contain only valid characters and not contain a trailing slash or wildcard character."]}
Any idea to what I'm doing wrong?