我正在尝试将数据从 Azure 函数输出到 CosmosDb (MongoDb),我有以下绑定设置:
[DocumentDB("mydatabase", "mycollection",
ConnectionStringSetting = "CosmosDBConnection",
CreateIfNotExists= true,
PartitionKey = "SomeKey")]
IAsyncCollector<MyEntity> mongoBinding,
在我的代码中,我执行以下操作:
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;}
}
结果错误:
{“错误”:[“无法接受分区键组件定义路径'SomeKey',在位置'0'附近失败。分区键路径必须仅包含有效字符,并且不能包含尾部斜杠或通配符。”]}
知道我做错了什么吗?