Amr*_*him 6 javascript firebase firebase-realtime-database angularfire2
我有很多孩子这样的父母:
Parent:{
"childe1":"data",
"childe2":"data",
"childe3":"data",
"childe4":"data",
"childe5":"data"
}
Run Code Online (Sandbox Code Playgroud)
如何同时更新孩子[ childe1 , childe2 , childe3 ],防止其他任何用户同时更新?
Fra*_*len 12
要同时更新多个属性,您可以运行update()呼叫:
ref.child("Parent").update({
childe1: "newdata",
childe2: "newdata",
childe3: "newdata"
});
Run Code Online (Sandbox Code Playgroud)
您甚至可以将路径指定为键,以防属性位于树中的不同级别.虽然这似乎不是这种情况,但语法是:
ref.update({
"Parent/childe1": "newdata",
"Parent/childe2": "newdata",
"Parent/childe3": "newdata"
});
Run Code Online (Sandbox Code Playgroud)
确切的验证取决于您想要允许的内容,但通常您会在服务器上编写符合您要求的规则.validatenewData.
| 归档时间: |
|
| 查看次数: |
5997 次 |
| 最近记录: |