遇到开发问题:我的收藏列表中需要标注创建人昵称!! 目前有user、room两个集合,我通过ref关联查询出了我的收藏列表。但是列表中还需要创建人昵称,不知该怎么办? var userSchema = new Schema({ user_id:String, password: { type: String, default: "" }, nickname: { type: String, default: "" }, favorite:[{type:Schema.Types.ObjectId,ref:'Room'}] }); var roomSchema = new Schema({ room_id:String, title:{ type: String, default: "" }, createTime:{ type: String, default: "" }, content:{ type: String, default: "" }, creator:{type:Schema.Types.ObjectId,ref:'User'}, cNickname:{ type: String, default: "" } });
回复 (7)
A
J
晕,似乎不支持加好友
J
W
引用 JarvisQJ为什么么人问津
Comment.find(condition).populate({
path: 'from',
model: 'Content',
populate: {
path: 'author',
model: 'User'
}
});
W
看懂了 我也遇到这个问题 还没想好怎么处理 哈哈
S
populate 可以嵌套的
来自酷炫的 CNodeMD
J
为什么么人问津
参与回复
登录后即可参与回复。登录