基于其他字段的DynamoDB更新
目前,我有一个帖子表,该表存储喜欢 和 puntriity ,我基本上想更改 Puntriity puminity 字段,取决于此喜欢字段,例如:
if (likes > 100) popularity = 3
else if (likes > 50) popularity = 2
else if (likes > 10) popularity = 1
else popularity = 0
PURINTIOS(0)意味着该帖子是新的,而受欢迎程度(3)帖子是用户在探索页面上看到的最多的帖子。
现在,我需要获取每篇文章以获取他们的总喜欢,然后致电其 Pumority 的更新。有没有办法在一个单个更新功能中执行此操作,而无需事先获取帖子?
Currently I have a posts table which stores likes and popularity, basically I want to change the popularity field depending on this likes field, such as:
if (likes > 100) popularity = 3
else if (likes > 50) popularity = 2
else if (likes > 10) popularity = 1
else popularity = 0
Popularity(0) means the post is new, whereas popularity(3) posts are the ones users see the most on their explore page.
Right now I need to fetch each post to get their total likes and then call an update for its popularity. Is there a way to do this in one single update function without fetching the post beforehand?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论