I'm new with nestjs. I use @nestjs/mongoose and I need to reference several fields in a nested object in my class schema and I don't know how to do it.
The dietDays object must contain a date field and meals object that contain a 2 references to Meal schema.
What is the correct way to do it?
The code below shows how I tried to do it, as well as, the other way I tried was that create dietDays class and pass it to Prop type variable but in that scenario I am not able to reference to Meal schema because that was not a schema.
@Schema()
export class Diet {
  @Prop({ default: ObjectID })
  _id: ObjectID 
  @Prop()
  dietDays: [
    {
      date: string
      meals: {
        breakfast: { type: Types.ObjectId; ref: 'Meal' }
        lunch: { type: Types.ObjectId; ref: 'Meal' }
      }
    },
  ]
}