Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

small changes to large objects

Tags:

firebase

I have a situation where on my nodejs server, I want to call periodically call .once('value', ..) on a very large object tree.

I expect there to be lots of small changes to the tree. I'd like to make sure I'm not fetching the entire tree each time there's a change to it or I want to read it.

If I set up a .on('value', function() { //does nothing }) callback, will that keep the tree cached in memory such that only the changes get sent to my server instead of the whole thing?

like image 632
josh Avatar asked Dec 03 '25 23:12

josh


1 Answers

Yes. If you have an outstanding event callback registered (even if it does nothing, like in your example), the data will be cached and you'll receive incremental updates as changes occur. So it sounds like that's what you're looking for.

like image 196
Michael Lehenbauer Avatar answered Dec 05 '25 12:12

Michael Lehenbauer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!