每次插入或更新新文档时更新另一个集合 [英] Update another collection everytime a new document is inserted or updated

查看:54
本文介绍了每次插入或更新新文档时更新另一个集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道每次插入或更新新文档(coll1)时如何更新/插入另一个集合(coll2)的更好方法。

would like to know the better way how to update/insert another collection (coll2) everytime a new document is inserted or updated (coll1).

我的收藏品将通过BulkImport一次获得近10K +文件。

my collection will get almost 10K+ documents at a time via BulkImport.

1)触发(类型:POST with Operation:Create )

1) Trigger (Type : POST with Operation: Create)

2)带有更改Feed的功能应用程序(由于我不熟悉,必须对此进行探索)

2) Function Apps with change Feed (Have to explore on this as I am not familar)

如果还有其他的,请告诉我。方式,请通过一些例子向我提供更多详细信息。

Let me know if there are any other way , Please provide me more details on high level with some examples.

推荐答案

嗨Ananth,

Hi Ananth,

通过
要在特定集合中执行的存储过程,用户定义函数和触发器
(以确保ACID事务)以及Azure函数和逻辑应用程序的使用,您可以构建一个由事件驱动的强大解决方案。

Through a combination of Stored Procedures, User Defined Functions, and Triggers to be executed in a specific collection (to ensure ACID transactions) and the use of Azure Functions and Logic Apps, you can architect a robust solution that is event driven.

Azure Cosmos DB + Functions Coo kbook - 多触发器

问题在于,因为SP和触发器仅在单个集合的范围内运行,所以您需要一个外部解决方案,用于驱动和组织构成解决方案的所有Cosmos DB集合的更新过程。 Azure Functions和
Logic Apps服务是一个很好的解决方案。否则,您需要对客户端进行编码以逐步执行所需的逻辑,调用各个端点以触发所需的CRUD操作。 

The issue is that because SPs and Triggers only operate within the bounds of a single collection, you need an external solution to drive and organize the update process across all the Cosmos DB Collections that make up the solution. The Azure Functions and Logic Apps service is a good solution here. Otherwise, you would need to code a client to step through the desired logic, calling the various endpoints to trigger the desired CRUD operations. 

我希望这会有所帮助。如果您还有其他问题,请告诉我们。

I hope this helps. Please let us know if you have additional questions.


这篇关于每次插入或更新新文档时更新另一个集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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