gpt4 book ai didi

azure - 在 Azure Function 中使用 CosmosDbTrigger 检测 Cosmos DB 中的更新和删除

转载 作者:行者123 更新时间:2023-12-01 09:46:06 27 4
gpt4 key购买 nike

我正在尝试使用 CosmosDBTrigger 解决 Azure 函数中文档事件的数据库通知问题。

我收到插入和更新通知,但没有删除通知。有什么方法可以触发它,或者通过设计不会发生此类事件? (例如,事件溯源)

如果发生更新,有什么方法可以检查它是插入还是更新?也许看看ETag

最佳答案

Cosmos DB 更改源中没有删​​除,因此也不会触发函数:

The change feed includes inserts and update operations made to documents within the collection. You can capture deletes by setting a "soft-delete" flag within your documents in place of deletes

并且没有现成可用的插入/更新属性,他们建议您在应用程序级别执行此操作:

There is no system property yet. However, you can add an attribute to the document, to do a soft update by updating the document attribute.

引用均来自 Working with the change feed support in Azure Cosmos DB

关于azure - 在 Azure Function 中使用 CosmosDbTrigger 检测 Cosmos DB 中的更新和删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48491932/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com