0

I have the following collection:

collection firebase

And within this collection (0) I have nested modules -> videos as shown below:

enter image description here

What I want to achieve is that in the section, for example: modules[0].videos[0], the property finishedState = true. I am trying as follows:

try {
      const cursos = doc(firebase.db, "misCursos", "7eIHn6FtYIOcFEWq2mXE");

      await updateDoc(cursos, {
        "0.modulos.0.videos.0.videoFinalizado": true,
      });
    } catch (error) {
      console.log(error);
    
}

But this removes all other modules with their videos and leaves me only **modules[0] -> videos[0] -> **finishState: true

My question is, how can I do to modify ONLY the property that belongs to that section?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
farid
  • 1
  • Dot notation doesn't work with array indexes. Consider reading the document into memory, modify it there, then write it back. – Doug Stevenson Jan 05 '23 at 05:23

0 Answers0