hi guys i try update object in 3 rd level of nested array
this is the sample document
{
"companyId": {"5ec1c4c7ea40dd3912ff206d"},
"memberId": {"61e538180d543336dfa52a94"},
"isActive": true,
"name": "SISWA1",
"profileImage": "string",
"email": "1@siswa.com",
"phone": "088123123123",
"mainClassId": null,
"classId": null,
"datas": [
{
"id": {"6350ce45605a1c2f35e4c607"},
"classId": {"62f19d68c149abd43526d1a3"},
"lessonId": {"62f0af32cb716c443625c3d0"},
"year": "2002",
"report": [
{
"activityId": {"6350f1313f586971dfd1effd"},
"meet": 3,
"isPresent": true,
"scores": [
{
"key": "TUGAS",
"value": 50
}
]
},
{
"activityId": {"6350f13aaa8f2d84071fc3cd"},
"meet": 4,
"isPresent": true,
"scores": [
{
"key": "TUGAS",
"value": 50
}
]
}
]
}
]
}
I’ve tried this way but there’s no change.
i want to update field meet in array report with id=“6350f13aaa8f2d84071fc3cd”, from 2 became 12
student_activity_op = await USER_STUDENT.update_one(
{"datas.report.activityId": ObjectId("6350f13aaa8f2d84071fc3cd")},
{
"$set": {
"datas.$[outer].report.$[inner].meet": 12
}
},
{
"$arrayFilters": [
{"outer.id": ObjectId("6350ce45605a1c2f35e4c607")},
{"inner.activityId": ObjectId("6350f13aaa8f2d84071fc3cd")}
]
},
)
if anyone can provide a solution i will appreciate