Thank you for your help Eoin, But I need some more information…
I am fully aware that there are multiple solutions, but that the most simplistic is what is programed into the solution. I also understand that this is going to be an exact science since it is running an automated validation. (there are no variants programed into the solution) So…
Logic would dictate that the solution should track the requirements that are given in the lab right? If so… then the solution (while there are many) should look for the field “formats”, “product_id”, “description” and “authors” right?
We will make the following modifications to our current schemas to have all documents share some common elements:
Across all documents, we will use a new field called format that will have a value of book, ebook, or audiobook.
Across all documents, we will have a field called product_id that will accept an integer as its value.
The field description should be unified across all documents.
The field authors should be unified across all documents.
To complete this task, complete the following steps:
Modify the following schemas to incorporate the changes stated above:
If I am supposed to program the solution this way, then I HAVE to have the above fields right? I need an answer on this before I continue… I am at a loss since I can get no indication as to what fails in my solution. Here is my solution:
According to my correspondence above, this should pass… But it doesn’t. I have no idea as to why.
The format field has been changed to eformats according to the advise above… If product_id is supposed to be across all documents, I added it to the different formats to enable tracking and reference the common fields (it should stay the same across the different formats). I have left the pages for “epub” and “pdf” alone since they can be unique. “audio” has the “narrator” and “length_minutes” field since this is unique to this format…
It fails validation…
PS D:\65945\m320> ./validate_m320 pattern_polymorphic --file pattern_polymorphic.json --verbose
Answer Filename: D:/65945/m320/pattern_polymorphic.json
Processing document: 1
... against solution: 1
The document fails validation.
At least one of your solutions is not passing validation.
I have no idea where I can go from here… And I am really confused since mongo stresses that data duplication is ok (not ideal, but ok)… I have watched the polymorphic video 10 times and while it is a good video, it doesn’t clearly go over how to go about combining the different documents into a single view.
It would be great to see this in action to understand the process. (watch the lecturer modify an actual schema)