Reputation: 99
How I can to put on the table all values contabilidad (pago) to 0, all the same time not one by one?
Upvotes: 0
Views: 679
Reputation: 598648
Firebase recently introduced the ability to 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);
});
Also see this blog post on how to use this feature for atomic client-side fan-out.
Upvotes: 4