Search code examples
firebasegoogle-cloud-firestoregoogle-cloud-functionsfirebase-cli

Does the Firebase Firestore Function onWrite support multiple params?


The #onWrite Firebase Firestore function - I understand from the docs and several examples across the web that Firestore functions support ONE variable/param in the path, eg:

functions.firestore
  .document('tests/{firstId}')
  .onWrite((change, context) => { ... })

... but I can't find docs or examples if it supports multiple params in the path, eg:

functions.firestore
  .document('tests/{firstId}/nested/{secondId}') //- note the secondId
  .onWrite((change, context) => { ... })

In my tests running on local Firestore emulator, this function doesn't fire.

Can anyone confirm if multiple params are supported or not?


Solution

  • It does support multiple wildcards in the document path. There is an example in the documentation.

    If you're having a problem with the emulator, file a bug report with the firebase-tools repo.