【发布时间】:2017-12-07 10:45:32
【问题描述】:
我想创建绑定到 cosmos DB 的 azure Function。
- 每当“A”集合中发生某些插入时,我都想更新“B”集合。
- “B”集合有存储过程,我想在插入集合“A”后调用它。
我是 Azure 和 cosmos-DB 的新手。
建议我需要做什么来完成要求。
还使用以下代码更新了 function.json。
{
"bindings": [
{
"type": "cosmosDBTrigger",
"name": "input",
"direction": "in",
"leaseCollectionName": "leases",
"connectionStringSetting": "cdb-swm-dev-001_DOCUMENTDB",
"databaseName": "admin",
"collectionName": "aomsorders",
"createLeaseCollectionIfNotExists": true
},
{
"type": "documentDB",
"name": "inputDocument",
"databaseName": "admin",
"collectionName": "aomsorders",
"connection": "cdb-swm-dev-001_DOCUMENTDB",
"direction": "in"
},
{
"type": "documentDB",
"name": "outputDocument",
"databaseName": "admin",
"collectionName": "test",
"createIfNotExists": true,
"connection": "cdb-swm-dev-001_DOCUMENTDB",
"direction": "out"
}
],
"disabled": false
}
还更新了集成部分如下
任何建议都会受到重视。
【问题讨论】:
-
到目前为止,您自己做了哪些工作?
-
让我看看我是否理解正确:您想要一个 Azure 函数,它正在侦听一个集合(使用触发器)然后写入第二个集合(使用输出绑定)?
-
@MatiasQuaranta 是的,完全正确。
-
我看到您仍在使用门户来编写函数。本周一,Visual Studio 发布了新版本 15.5,这使得使用 CosmosDB 编写功能变得非常容易。在此处查看屏幕投屏sarosh.wordpress.com/2017/12/06/…
标签: azure azure-cosmosdb azure-functions