0
votes

I am using Cloud Functions with Python (Beta) to trigger the function when new item is added at .../search/query/

If I was doing the same in Firebase Cloud Functions (using Node.js) it will be trigger via following code:

functions.database.ref('.../search/query').onCreate((snapshot, context) => ...)`

Function will be triggered when {'B': 'B'} is added at ...search/query/ with following database tree:

...: {
    'search': {
          'query': {
              'A': 'A'
           }
    }

Assuming the similar approach for Python - I created Cloud Functions with Python which trigger using following: Google Cloud Functions Console

But with Cloud Function in Python the function is trigger only when .../search/query is created but not triggered when a new item is added to .../search/query/

So how do I trigger function only when a new item is added at .../search/query/ given I do not know the key of the new item that will be added?

1
Please edit your question to show the gcloud command you're using to create the trigger. - Doug Stevenson
I am using google cloud console to set up triggers. @DougStevenson - Slick Slime

1 Answers

2
votes

As suggested by the documentation for Database triggers paths, it sounds like you want a wildcard in the path:

.../search/query/{id}

Where id is a wildcard that will match when any new child is added under search/query.