AngularFire 我如何更新所有值

AngularFire how I can update all values

我怎样才能把table所有的值contabilidad (pago)都设置为0,而不是一一设置?

Firebase 最近引入了 update multiple locations with one update() call 的功能。

ref.child('contabilidad').once('value', function(snapshot) {
  var updates = {};
  snapshot.forEach(function(child) {
    updates[child.key()+'/pago'] = 0;
  });
  ref.child('contabilidad').update(updates);
});

另见 this blog post on how to use this feature for atomic client-side fan-out