Tuesday, 18 April 2017

Firebase - OnWrite called everytime node updated

There's a problem with my onWrite() cloud function. I have the following database structure:

"data" : {
    "pushId" : {
      "date_time" : "date time",
      "status" : true
    }

The function works fine by sending a push notification whenever a new pushId is inserted into "data", however it also sends a push notification when a single child node is updated. For example whenever the status is changed to false it send another push notification.

Is there anyway to only send push notifications once, when a new pushId is inserted into "data" and never again for that pushId?

Thank you all for you help!



via xirlas

No comments:

Post a Comment