简体   繁体   English

onCreate触发Firebase云功能

[英]onCreate trigger firebase cloud function

So, I made a functions that triggers using the database realtime trigger "onCreate", the reference path is "something/{userId}". 因此,我做了一个使用数据库实时触发器“ onCreate”来触发的函数,参考路径是“ something / {userId}”。 What happened is that whenever there's a new child inside "something", the event triggers but I want that the events trigger when a new child is created inside "something/{userId}" and not in "something". 发生的事情是,只要在“某物”中有一个新的孩子,事件就会触发,但是我希望事件在“某物/ {userId}”而不是“某物”中创建一个新孩子时触发。

This is what I have right now, but don't work as I would like. 这就是我现在所拥有的,但是却无法如我所愿。

functions.database
  .ref('/stripe_customers/{customerId}/sources/{cardId}')
  .onCreate
functions.database
  .ref('/stripe_customers/{customerId}')
  .onCreate

This is how I have a similar one working. 这就是我进行类似工作的方式。 Hope it helps. 希望能帮助到你。 You just need to change the database path level that you want to track. 您只需要更改要跟踪的数据库路径级别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM