I have a doc in firebase representing a class in schoold, which has a list of object items including array of objects:
{{students: [{
id: "xxx",
name: "John",
weight: "55",
isPassed: false
},
{
id: "xxx",
name: "Marley",
weight: "44",
isPassed: false
},
{
id: "xxx",
name: "Beth",
weight: "48",
isPassed: false
},
{
id: "xxx",
name: "David",
weight: "58",
isPassed: true
},
]
},
teachers: {{...}},
name: "Tigers"
}
I am trying to update all items having isPassed
key to true
. I need something like:
await updateDoc(doc(db,"classes", class.id), {
"students.isPassed": true // I know this synthax is wrong
})
How is this possible?