Reputation: 43
I want to query firebase from my server, in a similar way that firebase functions.
I want to do something like this:
const db = firebase.database();
const ref = db.ref('something/{some_id}');
ref.on('child_added', snap => {
// Do something
}, console.error)
For data like:
And I want to get a child_added event for subkey1, subkey2, subkey3.
I don't know what key1 and key2 value is, and I know that subkey? are automatic created by push()
Is that possible?
In cloud functions I can do something like:
functions.database.ref('/something/{some_id}/{subkey}').onWrite(....)
I would want to do the same on my own backend.
Upvotes: 0
Views: 876
Reputation: 317768
There are no wildcards with database listeners. Database listeners are completely different than Cloud Functions triggers.
A database listener is always constrained to the scope of the path where it was added. The only way to receive events for anything that happens under a certain location (without wildcards) is to use a value event listener and respond to each and every change made at that location. And that's likely going to be difficult to figure out what exactly is changing at each event.
Upvotes: 1