I'm new in MEAN stack development. Please anyone tell how to search in Mongoose populate array. that array containing ref.
Discussion Schema:
const discussionSchema = new Schema({
user_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
},
subject_title: {
type: String,
required: true
},
keywords: [
{
type: Schema.ObjectId,
ref: 'Keyword',
default: null
}
},
{
timestamps: true
}
)
Keyword Schema:
const keywordSchema = new Schema({
keyword:{
type: String,
required: true,
unique: true,
}
}, {
timestamps: true
})
How To Search Keyword String In keyword array containing ref ID of Keyword Model.