如何使用Azure功能更新集合 [英] How update collections using Azure functions

查看:75
本文介绍了如何使用Azure功能更新集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建绑定到cosmos DB的azure函数.

I want to create the azure Function which is bind to cosmos DB.

  • 每当在"A"集合中发生某些插入时,我都想更新"B"集合.
  • "B"集合存储了要在集合"A"中插入后要调用的存储过程.

我是Azure和cosmos-DB的新手.

I am new to Azure and cosmos-DB.

建议我需要做些什么才能达到要求.

Suggest me what need to be done to accomplish the requirement.

到目前为止,我已经创建了Azure函数

So far I have created Azure Function

还使用以下代码更新了function.json.

Also Updated the function.json with below code.

{
  "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
}

还更新了集成部分,如下所示

Also Updated the Integrate Part as below

任何建议都是可取的.

推荐答案

我发现您的问题不是很具体,但是从广义上讲,您至少有两个选择:

I find your question not very specific, but broadly you have at least two options:

  • 从同一Azure函数插入两个集合

  • Insert to both collections from the same Azure Function

从第一个Azure函数插入集合1,然后使用

Insert to the collection 1 from the first Azure Function, then have a second Azure Function with Cosmos DB trigger listening to the changes of collection 1 and updating collection 2

我敢肯定还有其他选择.

I'm sure there are other options too.

这篇关于如何使用Azure功能更新集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆