Beispiel in der Mongoose füllen
const Live = new Schema(
{
user_id:{ // this one populate
type: Schema.Types.ObjectId,
ref: 'User', // User Schema
required: true
},
title: {
type: String,
},
category:{ // this one populate
type: Schema.Types.ObjectId,
ref: 'Category' // Category Schema
},
}
)
let vid = await Live.find({})
.populate({path:'user_id',select:'name image -_id'})
.populate({path:'category',select:'category -_id',model:Category})
Angry Albatross