I have a table like this
person = {
name : String,
favoriteFoods : [{type:Schema.Types.ObjectId, ref:'Food'}]
}
Q1: I would like to do the searching fast when I search for person with particular favourite food.
May I know if it is possible to index the favoriteFoods field and how to do it?
Q2: Alternatively, I would like to populate the favoriteFoods fields with Food content when I get back the person documents. May I know if there is command to do so?