Yes, thank you, that makes it clear. I am still having issues with the lab though. I find the other tasks also a bit confusing or maybe there is something I don’t know about schema design in MongoDB and that is why I find it difficult.
Similarly to the first and last name the problems tells us that the recruiting_source field should be in each document in the array, but at the same time later it also says that we should create this field only when a document doesn’t have a program_affiliation field, which to me sounds like a contradiction. From my understanding the value of program_affiliation should be maybe referenced in the recruiting_source field, but I don’t know how that would work in Mongo. I am probably overthinking it in some way.
Also after thinking about it, I don’t understand why there should be a field for name and last name in each document in the array if this is a a case where we should be implementing a polymorphic pattern, so shouldn’t we be trying to avoid the repetition of certain fields?
For a long time I was replicating the same solution like it was presented in the video about polymorphic pattern with the people and addresses example, where in our lab case instead of address as the array we have recruiting_source as the array name.
UPDATE: I just checked the answer and I am not sure how the solution provided qualifies as a use of polymorphic pattern. It seems like we just duplicated a lot of fields and did not try to narrow the number of certain fields that can me simplified, where in the video I believe the example is a clear showcase of the pattern.