Not required, unless you think its useful within your application.
If I try to iterate over the field of the main document to access the values, I can only iterate over the sub-documents, or if I follow your suggestion, over the arrays of sub-documents.
Consider a single document in the collection.
Consider the structure of the original one, you do not iterate over the nested documents Skill_1
and Skill_2
. In the mongo
shell you access a nested document field using a dot-notation; for example: “Skill_1.Parameter”. This notation can be used within the query filter as well as the projection. Reference: Query on Embedded/Nested Documents.
Consider the structure I had suggested. The query I had posted in my earlier post is the way to get to a specific sub-document.
MongoDB supports various operators to work with array fields. Add nested document to an array field. Also, modify a specific nested document or delete one. Further there are operators to query, filter, perform projection, iterate, etc. This is de-normalized data model at work.