I am learning firebase cloud functions. I have a function that looks like that:
exports.gameLoopBeing = functions.database.ref('/tables/{pushId}/gamestarted')
.onWrite(event => {
//I want to retrieve the pushID
console.log(event.data.pushID);
});
event.data.pushID clearly doesn't work. How can retrieve the pushID? I looked at the docs and couldn't find anything.
For those who don't know that pushId is. This function listens to every change done inside elements inside /table. For example:
The wildcards in the ref path are provided in the event params object:
exports.gameLoopBeing = functions.database.ref('/tables/{pushId}/gamestarted')
.onWrite(event => {
//I want to retrieve the pushID
console.log(event.params.pushId);
});
exports.gameLoopBeing = functions.database.ref('/tables/{pushId}/gamestarted')
.onWrite((change, context) => {
//I want to retrieve the pushID
console.log(context.params.pushId);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With