NodeBB - Post Reputation/Likes - 查找哪些用户喜欢 post

NodeBB - Post Reputation/Likes - Find which users liked a post

我找不到 NodeBB 在哪里存储喜欢特定 post 的用户列表。 例如,考虑以下数据结构:-

> db.objects.find({_key:"post:2341"}).pretty()
{
    "_id" : ObjectId("5547af3f65190fe2122d0b3c"),
    "_key" : "post:2341",
    "edited" : 0,
    "pid" : 2341,
    "content" : "content of this post",
    "tid" : 2543,
    "timestamp" : 1412304172707,
    "deleted" : 0,
    "editor" : "",
    "uid" : 747,
    "toPid" : 19999,
    "votes" : 0,
    "reputation" : 5
}

上面说 Post ID 23415 个声誉,这意味着它被 5 用户喜欢。但是它在哪里存储这些是喜欢这个特定 post 的用户 ID?

终于通过 NodeBB 代码找到了将它存储在数据库中的确切密钥。存储它的特定密钥是 pid:{postid}:upvote。所以我们这样查询:-

>db.objects.find({_key: "pid:2341:upvote"})
{
    "_id": ObjectId("5547af3f65190fe2122d0b3c"),
    "_key": "pid:2341:upvote",
    "members": ["663", "230", "549"]
}

以上响应包含给特定 post 点赞的用户的 ID。