我有一个用户喜欢
name : {
  type : String
},
organizations : [{
  type : mongoose.Schema.ObjectId,
  ref : 'Organization'
}]
和这样的组织:
name : {
  type : String
},
members : [
  user : {
    type : mongoose.Schema.ObjectId,
    ref : 'User'
  },
  role : {
    type : String
  }
]
如果我想获取用户可以访问的每个用户,比如说他组织的成员列表中的所有用户,我该如何进行查询(填充用户会很好)?
为了让我想到的所有组织:
Organization.find({ '_id' : { $in: user.organizations } }).exec(function (err, organizations) { });
我想避免多次查询,感谢任何帮助!