How do I write/update data to multiple child nodes via Firebase Cloud functions?

前端 未结 2 1420
暗喜
暗喜 2020-12-22 02:26

I\'ve got a database that looks like this:

I want to reset the Patient_List and Current_Token children to 0 at a particular time (

2条回答
  •  被撕碎了的回忆
    2020-12-22 03:14

    Only use the general ref, and before that reference all nodes that you want to update, just like this:

    var gralRef = firebase.database().ref();
    var obj_update={};                              
    obj_update[`users/${firstuser}/name`]='John';
    obj_update[`users/${seconduser}/name`]='Mark';
    obj_update[`users/${seconduser}/address`]='New York';   
    
    
    gralRef.update(obj_update);                     
    

提交回复
热议问题