Xao
Xao

Reputation: 601

Match multiple collections in eventarc within the same firestore document path pattern

Based on this docs is it possible to match two different collections and trigger the same CF 2nd gen on doc creation for users/ and clients/ collections?

I tried different approaches, but no luck:

{col=[uc]*s}/{id}

{col=[clients,users]}/{id}

{col=clients,users}/{id}

It seems that a CaptureGroup can have 0 or one Expression which can be a NameSegment therefore Character and 0 or one Wildcard in between Characters?

Can we have a NameSegment with: Character Wildcard? Character Wildcard? Character... per example?

What I don't get is, what are \\w\\s\\t~@#$%&.,?:;+='[]()- referring to, are just literal chars or can we construct a form of regex?

Upvotes: 0

Views: 47

Answers (1)

Alex Mamo
Alex Mamo

Reputation: 139019

As @DougStevenson mentioned in one of his comments, the official documentation for Firestore triggers does not mention anything about using wildcards that match anything other than a single path segment:

Wildcard matches are extracted from document paths. You can define as many wildcards as you like to substitute explicit collection or document IDs. You can use up to one multi-segment wildcard like {username=**}.

So the best option that you have is to create two separate Cloud Functions, even if both have the exact same code.

Upvotes: 0

Related Questions