How to delete the array elements at index in firestore in javascript

后端 未结 3 1545
面向向阳花
面向向阳花 2021-01-26 14:54
    var arr = [ \"GKRLrcpSL2BmKx3BfvWj\",\"fMwH404fweoFJJqyE5Nf\" , \"DTurwbw64CWw4WosUQtC\" ] //
arr.forEach((element) => {
    console.log(element);
    db.collecti         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-26 15:17

    If that works for you, use a map instead of an array, putting dummy values if necessary. Then you can remove the field directly.

    fill: {
      a: xxx,
      b: xxx,
      check: xxx
    }
    
    db.collection("Check").doc(element).update({
      fill.check: firebase.firestore.FieldValue.delete()
    })
    

提交回复
热议问题