new Schema({
pid: {type: String, ref: ‘product’},
sid: {type: String, ref: ‘sale’},
}));
假设有 product 和 sale 两个集合
pid 和 sid 指定的都是 product 和 sale 集合的 user_id
而不是 _id
用 populate 填充 总是把 pid 和 product 的 _id 关联上了,然后就查询不出来
有什么办法 pid 和 sid 指定的是 user_id 而不是 _id
求大神解答
Populate Virtuals