0

考虑我的 Mongo 模式设计......

我想代表个人资料之间的朋友关系,这些关系应该包含​​属性,而不仅仅是引用。

考虑了以下简单的配置文件:

{
  "pid:"profileId"
  "friends":[
   {
     "friendId":"friendId"
     "isCloseFriend": "true/false"
     "points":"points"
   },
    {
     "friendId":"friend2Id"
     "isCloseFriend": "true/false"
     "points":"points"
   } .....]
}

我需要能够执行以下操作:

1)对于给定的个人资料,我需要检索在同一结果集中具有至少一个共同密友和共同密友(或参考)的所有个人资料。

2)按点检索我朋友的前X个..包括结果集中的点。

通过查询/ map-reduce 执行这些用例的正确方法是什么?如何...

感谢您的回答。

4

0 回答 0