我正在尝试从 Azure 函数脚本写入 cosmosDB 服务。该函数正确执行,在我的 cosmosDB 指标中,我可以看到传入的请求。新表和集合也在 cosmosDB 中创建,因此请求正在通过。
然而,没有在集合中创建新实体。我是否忘记了什么或错误地理解了什么?
索引.js
module.exports = function (context, message) {
context.bindings.testDocument = JSON.stringify({
name: "name",
duedate: "duedate",
task: "task"
});
context.log('context binding set');
context.done();
};
函数.json
{
"bindings": [
{
"type": "eventHubTrigger",
"name": "message",
"direction": "in",
"path": "samples-workitems",
"connection": "MAP-hub_events_IOTHUB",
"cardinality": "one",
"consumerGroup": "$Default"
},
{
"type": "documentDB",
"name": "testDocument",
"databaseName": "testDataBase",
"collectionName": "testCollection",
"createIfNotExists": true,
"connection": "raw-data-storage_DOCUMENTDB",
"direction": "out"
}
],
"disabled": false
}
数据库
创建的数据库和集合的屏幕截图:
指标
cosmosDB 指标的屏幕截图:
You have a Cosmos DB account with the Table model. The Table model has some schema restrictions in the documents you can send to it using the SQL API (the Cosmos DB Output binding uses the SQL SDK to persist documents).
If you want to use the Output binding, try with a Cosmos DB SQL type of account.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句