Tus*_*tel 4 triggers azure-functions azure-cosmosdb
我在 azure 函数中有 cosmos db 触发器,当文档更改时它会触发,这很好。
但我的文档很大,我只需要触发器中更新的属性。
我可以通过比较新旧文档来解决这个问题,但在触发器中我只得到更新的文档。
那么有没有办法在触发器中获取旧的和更新的文档。
我的 Azure Function 触发器是
module.exports = async function (context, documents) {
if (!!documents && documents.length > 0) {
context.log('Document Id: ', documents[0].id);
context.log('Document : ', documents[0]);
}
context.done(); }
Run Code Online (Sandbox Code Playgroud)
我的函数绑定是
{ "bindings": [
{
"type": "cosmosDBTrigger",
"name": "documents",
"direction": "in",
"leaseCollectionName": "leases",
"connectionStringSetting": "AzureWebJobsCosmosDBConnectionString",
"databaseName": "ToDoList",
"collectionName": "Items",
"createLeaseCollectionIfNotExists": true
} ], "disabled": false }
Run Code Online (Sandbox Code Playgroud)
提前致谢
归档时间: |
|
查看次数: |
2098 次 |
最近记录: |