Open maciej-bielecki opened 4 years ago
In realtime database, what I want to achieve is to query the data (filter / limit etc.) and attach child event listener to be informed about changes.
In the firebase documentation there is shown way to listen for child events by calling .on() on reference and passing required event, i.e. child_added: https://firebase.google.com/docs/database/web/lists-of-data#listen_for_child_events
.on()
child_added
But passing child_added or any other child related event name seems not to work. It acts as value so all collection is passed on handler.
value
var commentsRef = firebaseWebApi.database().ref(`/comments`); commentsRef.child(`collecion_name`).on('child_added', function(data, prevChildKey) { console.log(`child_added ${data.key}` + JSON.stringify(data.val())); });
Is there any other way to listen for child events but on query that uses some filters? I did not seen a way both in Native API, or the Web API.
In realtime database, what I want to achieve is to query the data (filter / limit etc.) and attach child event listener to be informed about changes.
In the firebase documentation there is shown way to listen for child events by calling
.on()
on reference and passing required event, i.e.child_added
: https://firebase.google.com/docs/database/web/lists-of-data#listen_for_child_eventsBut passing
child_added
or any other child related event name seems not to work. It acts asvalue
so all collection is passed on handler.Is there any other way to listen for child events but on query that uses some filters? I did not seen a way both in Native API, or the Web API.