【发布时间】:2017-10-11 06:17:04
【问题描述】:
是否可以在不覆盖其他孩子的情况下跨多个父母更新单个孩子?
我的 Firebase 数据如下所示:
notifications:
uniquenotif1:
a: true
b: true
uniquenotif2:
a: true
b: true
我尝试使用 Swift 仅更新名称为 a 的孩子:
notificationsRef.updateChildValues([uniquenotif1: [a:false], uniquenotif2: [a:false])
这样得到的数据如下:
notifications:
uniquenotif1:
a: false
uniquenotif2:
a: false
这就是我希望它们看起来的样子:
notifications:
uniquenotif1:
a: false
b: true
uniquenotif2:
a: false
b: true
要求这需要作为单个操作发生(我正在使用 Cloud Functions 发送取决于这些值的推送通知)。
如果可能的话,我不想传递所有孩子的值(a AND b)。
【问题讨论】:
-
让得到完整的孩子然后更新预期的孩子。
标签: ios swift firebase firebase-realtime-database google-cloud-functions