Hey @Han_Heloir,
As was given in the problem statement, you had the modify the following schemas:
[{
"_id": "<objectId>",
"product_id": "<int>",
"title": "<string>",
"description": "<string>",
"authors": ["<string>"],
"publisher": "<string>",
"language": "<string>",
"pages": "<int>",
"catalogues": {
"isbn10": "<string>",
"isbn13": "<string>"
}
}, {
"_id": "<objectId>",
"title": "<string>",
"desc": "<string>",
"authors": ["<string>"],
"publisher": "<string>",
"language": "<string>",
"eformats": {
"epub": {
"pages": "<int>"
},
"pdf": {
"pages": "<int>"
}
},
"isbn10": "<string>"
},{
"_id": "<objectId>",
"title": "<string>",
"desc": "<string>",
"author": "<string>",
"narrator": "<string>",
"publisher": "<string>",
"language": "<string>",
"length_minutes": "<int>"
}]
Your solution did not fully implement polymorphic pattern. I would recommend watching the lecture video again and reading the instructions of the lab.
As per instructions given in the lab, a learner is supposed to:
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.
Hence, for this lab, firstly we create a field called format
. In this field, we put one of the strings book, ebook, or audiobook.
Secondly, we need to add the field product_id
to the ebook and audiobook documents.
Third, we want to unify the description across the documents. There are two ways we can do that. The first is to rename the field desc
to the description
for the ebook and audiobook. An alternative is to make a copy of the contents of desc
into description
to keep some backward compatibility. Both solutions would work.
Finally, for the authors
, we need to turn the author of the audiobook documents from a string to an array of strings.
Since you did not fully implement what the instructions said, the validator gave you The document fails validation
warning, but generated the validation code for @Kushagra_Kesav’s solution.
Hope this helps. Feel free to reach out if there is anything else as well.
Regards,
Satyam