逻辑应用 > Cosmos PartitionKey 不匹配错误
Logic App > Cosmos PartitionKey Not Matching Error
我不敢把它放在那里,因为它应该很简单,我面临着与 post here, and 相同的问题,我已经尝试了每个答案都无济于事.以下是输入的当前结果输入(编辑)和相关代码视图。
结果
{
"method": "post",
"headers": {
"x-ms-documentdb-raw-partitionkey": "\"2020\""
},
"path": "/dbs/xxxx/colls/smtp/docs",
"host": {
"connection": {
"name": "/subscriptions/..."
}
},
"body": {
"category": [
[
"cat facts"
]
],
"email": "example@test.com",
"event": "processed",
"id": "yada",
"partitionKey": "\"2020\"",
"sg_event_id": "yada yada",
"sg_message_id": "yada",
"smtp-id": "yada",
"timestamp": 1604345542
}
}
代码视图
{
"inputs": {
"body": {
"category": [
"@items('For_each')['category']"
],
"email": "@items('For_each')['email']",
"event": "@items('For_each')['event']",
"id": "@items('For_each')['sg_message_id']",
"partitionKey": "\"@{formatDateTime(utcNow(),'yyyy')}\"",
"sg_event_id": "@items('For_each')['sg_event_id']",
"sg_message_id": "@items('For_each')['sg_message_id']",
"smtp-id": "@items('For_each')['smtp-id']",
"timestamp": "@items('For_each')['timestamp']"
},
"headers": {
"x-ms-documentdb-raw-partitionkey": "\"@{formatDateTime(utcNow(),'yyyy')}\""
}
}
我遇到的错误是常见错误 - 从文档中提取的 PartitionKey 与 header
中指定的不匹配
我现在看不到我错过了什么。
谢谢大家。
首先,正如 Matias 所说,检查您的分区键路径。
然后,在您的文档中将此代码 "partitionKey": "\"@{formatDateTime(utcNow(),'yyyy')}\"",
更改为 "partitionKey": "@{formatDateTime(utcNow(),'yyyy')}",
。
在我这边效果很好:
我不敢把它放在那里,因为它应该很简单,我面临着与 post here,
结果
{
"method": "post",
"headers": {
"x-ms-documentdb-raw-partitionkey": "\"2020\""
},
"path": "/dbs/xxxx/colls/smtp/docs",
"host": {
"connection": {
"name": "/subscriptions/..."
}
},
"body": {
"category": [
[
"cat facts"
]
],
"email": "example@test.com",
"event": "processed",
"id": "yada",
"partitionKey": "\"2020\"",
"sg_event_id": "yada yada",
"sg_message_id": "yada",
"smtp-id": "yada",
"timestamp": 1604345542
}
}
代码视图
{
"inputs": {
"body": {
"category": [
"@items('For_each')['category']"
],
"email": "@items('For_each')['email']",
"event": "@items('For_each')['event']",
"id": "@items('For_each')['sg_message_id']",
"partitionKey": "\"@{formatDateTime(utcNow(),'yyyy')}\"",
"sg_event_id": "@items('For_each')['sg_event_id']",
"sg_message_id": "@items('For_each')['sg_message_id']",
"smtp-id": "@items('For_each')['smtp-id']",
"timestamp": "@items('For_each')['timestamp']"
},
"headers": {
"x-ms-documentdb-raw-partitionkey": "\"@{formatDateTime(utcNow(),'yyyy')}\""
}
}
我遇到的错误是常见错误 - 从文档中提取的 PartitionKey 与 header
中指定的不匹配我现在看不到我错过了什么。
谢谢大家。
首先,正如 Matias 所说,检查您的分区键路径。
然后,在您的文档中将此代码 "partitionKey": "\"@{formatDateTime(utcNow(),'yyyy')}\"",
更改为 "partitionKey": "@{formatDateTime(utcNow(),'yyyy')}",
。
在我这边效果很好: