I am a new user to mongodb and have a doubt regarding how to populate particular key of every object in an array . here is the schema of the collection i want to populate
var Sub_cat = new mongoose.Schema({
cat_id:{
type: mongoose.Schema.Types.ObjectId,
ref: "Cat"
},
name: String,
quantity_type: String,
selection_data:[{
price:Number,
selection_id:{
type: mongoose.Schema.Types.ObjectId,
ref: "Selection"
}
}]
});
here i wish to populate selection_id in selection_data array which i wish to further populate. can someone please help me out . Thank you !!