how do you delete a deeply nested field inside a firebase object map?

SOLUTION:

For future readers, this is the code I used to delete highly nested fields inside an Object Map.

      const userRec = db.collection('users').doc(UID);
      let userRecData = await userRec.get();
      let userRecResp = {};
      userRecResp = userRecData.data();
      delete userRecResp.CourseList[CID]['LectureList'][LID];  
      await db.collection('users').doc(UID).update(userRecResp); 

Please note, “UID”, “CID”, and “LID” are variable names.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top