This is my schema
friends: {
type: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
}],
required:false,
validate: [arrayLimit, '{PATH} exceeds the limit of 3']
}
I want to find all the user related Like populate but with multi user and I do not want all the user fields just the relvant for example
const responses = await Response.find({}).populate("friends", {name:1, username:1})
According to mongoose docs yo can do something like: