如何仅获取 dynamoDB 流上的 difference/modifications

How to get only the difference/modifications on dynamoDB streams

我有一个用例,我需要了解 dynamoDB 流上 NEW_IMAGEOLD_IMAGE 之间的区别。

根据

https://aws.amazon.com/blogs/database/dynamodb-streams-use-cases-and-design-patterns/

DynamoDB Streams supports the following stream record views:

KEYS_ONLY—Only the key attributes of the modified item
NEW_IMAGE—The entire item, as it appears after it was modified
OLD_IMAGE—The entire item, as it appears before it was modified
NEW_AND_OLD_IMAGES—Both the new and the old images of the item

我无法注册收听 IMAGE_DIFFERENCE 或类似节目。

那么,实现该目标的最佳方法是什么(最好在 JavaScript/TypeScript 中举个例子)?

你唯一的选择是在 NEW_AND_OLD_IMAGES 上收听并自己区分它们。如果 AWS 要实现类似 IMAGE_DIFFERENCE 的视图,它需要一些特殊的符号来告诉您删除了哪些条目,添加了哪些条目。该处理会增加与流相关的延迟,并且可能不适合足够多的用例以使其构建可行。