I am looking for the following desired results after update (I am using examples given above before update)
If contents within course is updated, like given below
{
"_id": "someID",
"contents": [
{
"sectionId": "section0",
"topicName": "ABC",
"topics": [
{
"topicId": 0
},
{
"topicId": 1
},
{
"topicId": 2
},
{
"topicId": 3
},
{
"topicId": 4
}
{
"topicId": 5
}
]
},
{
"sectionId": "section2",
"topicName": "GHI",
"topics": [
{
"topicId": 0
},
{
"topicId": 1
}
]
}
]
}
then userHistory schema shall also change accordingly
{
"_id": "someId",
"history": [
{
"sectionId": "section0",
"topicId": 0,
"status": 1,
"completedDate": "2/9/2022 10:46:34 AM"
},
{
"sectionId": "section0",
"topicId": 1,
"status": 0
},
{
"sectionId": "section0",
"topicId": 2,
"status": 1,
"completedDate": "2/9/2022 8:24:35 AM"
},
{
"sectionId": "section0",
"topicId": 3,
"status": 0
},
{
"sectionId": "section0",
"topicId": 4,
"status": 0
},
{
"sectionId": "section0",
"topicId": 5,
"status": 0
},
{
"sectionId": "section2",
"topicId": 0,
"status": 0
},
{
"sectionId": "section2",
"topicId": 1,
"status": 0
}
]
}
Is this achievable via arrayFilters?
As it requires dynamic sessionId changes