admin管理员组

文章数量:1308626

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?

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?

Share Improve this question edited Feb 15 at 4:47 Alex Mamo 1 Recognized by Google Cloud Collective asked Feb 1 at 19:55 XaoXao 6019 silver badges19 bronze badges 5
  • If you are using gcloud, you should show the actual command you're using to specify the matching pattern. It's possible that your shell is interpreting special characters before GCP can get a hold of them. Also consider that the doc you linked is for event arc in general (applies to multiple GCP products), and not specific to Firestore. Firestore might simply not support the kind of matching you're looking for, even though eventarc has syntax for it that seems to apply. – Doug Stevenson Commented Feb 1 at 20:39
  • no, I was using the console. ok then it might be a lack of documentation then? – Xao Commented Feb 1 at 21:08
  • The documentation for Firestore triggers doesn't say anything at all about using a wildcard that matches anything other than a single path segment in its entirety, or multiple path segments. "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=**}." – Doug Stevenson Commented Feb 1 at 21:09
  • Also see (for 1st gen Cloud Functions): stackoverflow/questions/60540384/…. While things may be different, I'm with Doug and don't interpret the documentation you linked in that way. – Frank van Puffelen Commented Feb 1 at 22:58
  • Thanks guys, I've already settled with two different CFs with the same codebase. – Xao Commented Feb 2 at 12:06
Add a comment  | 

1 Answer 1

Reset to default 0

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.

本文标签: