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?
- 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
1 Answer
Reset to default 0As @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.
本文标签:
版权声明:本文标题:firebase - Match multiple collections in eventarc within the same firestore document path pattern - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741864500a2401821.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论