userSchema
{
name: String
}
ContentSchema
{
uid: mongoose.SchemaTypes.ObjectId,
content: String,
status: {
type: Boolean,
default: true
}
}
现在想获取所有内容表 status 为 true 的信息, 可以使用 ContentModel.find({status:true})
这里返回的数据 Array
中想把 uid 替换为 user 表的 name 值,这里如何做?
创建数据用例:
接着获取删去相关生成用户和关联数据,