更新时间:2023-09-07 22:05:22
感谢马克·布朗的评论,我发现以下似乎是解决此问题的正确方法.不仅仅只是一次使用一些SQL就优雅,但这确实是需要的.
Thanks to Mark Brown's comment, I found the following which seems to be the correct solution to this problem. Not as elegant as just using some SQL for a one-off but is really what was needed.
从本质上讲,您创建了一个无服务器功能,该功能由Cosmos变更供稿触发并更新物化视图,该视图实质上只是一个文档(在这种情况下)具有最新的 data
每个 deviceId
.
In essence, you create a Serverless Function which is triggered by the Cosmos change feed and updates a materialized view, which is essentially just a document with (in this case) the most up to date data
per deviceId
.
专门针对这种情况,它很可能会使用最新数据来更新相应的 device
文档.
Specifically for this case, it'll most likely update the corresponding device
document with it's most recent data.