我正在运行一个事务来更新需要存储在两个键中的项目。要做到这一点,我已经建立了嵌套事务如下,似乎如预期运行:Firebase中嵌套事务的影响?
firebaseOOO.child('relationships/main').child(accountID).child(friendAccountID).transaction(function(data) {
data.prop = 'newval';
firebaseOOO.child('relationships/main').child(friendAccountID).child(accountID).transaction(function(data) {
return r;
});
return r;
});
是否有任何陷阱或可能的意外影响到这一点?我最担心的是在负载下陷入某种事务循环,其中每个事务都会取消另一个事务,迫使它们重新启动或类似。
有没有更好的方法来做到这一点?
我正在使用NodeJS客户端。
为什么不尝试多位置更新? - https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html – Badie 2018-03-04 21:40:40