Lab: Apply the Attribute Pattern

Hi, i have some difficulty to understand how to modify the shape of collection about the “date_acquisition” field. In my point of view it is an attribute of the opera. I don’t understand the request on this field.
The “events” array could be transformed as
“events”: [ {“loaned_to_museum”: “”, “loaned_to_date”: “”} ]

Thanks in advice


The structure needs to account for all dates: “date_acquisition” and the dates at which the piece was loaned.
I hope this little hint helps you.


Thanks Daniel but i have always my doubt,
If i have 1 date_acquisition for each opera, the date when the musem has owned the opera in its property, why i must account more than 1 date?
Probably i don’t understand the semantic of date_acquisition field.
Moreover followng your suggestion i shaped events as [{“date_acquisition”: “”, “k”: “”, “v”: “”}] where k is the musem name and v the loan date but the validator doesn’t work.
Last consideration: the second item of the task use the word “migrate”. What does it mean in this context? To move this piece of information in another collection or other?

Thanks in advice

you have a date_aquisition not for each museum but for each item. So only one.
The magic with the attribute pattern is it’s very flexible: so you can have what you want in your k value. You can see here the document event like a pair description for the event and date of the event. the aquisition date is just a event like the other museum event.
Hope that’s help.


thanks for your explanation, now it’s clearer.


you’re welcome buddy :wink:

Thanks Olivier, you clarified my doubt.

I understand the problem and I resolved, but the validate_m320 doesn’t work like a expect. I tried copying the solution in file with the required name and below I copy the resolve:

C:\Users\xxxxxx\Downloads>validate_m320 pattern_attribute --file pattern_attribute.json --verbose
Answer Filename: C:/Users/jmedina/Downloads/pattern_attribute.json

(root): Additional property location is not allowed

It looks like you have a property name location that is now supposed to be present.