收集的火箱规则从数字开始
我有一个名为2022收集的集合数字。如果我登录了该应用程序,我可以写和阅读,但无法制定Firestore规则以使其公开可读。从字母开始工作的收藏的规则正常,但数字完全错误。
如何为以一个数字开头的文档/集合制作云firestore规则?
这是我尝试过的几件事,显然没有工作。我认为应该有更好的文档,因为我未能找到任何解释它的东西。如果存在这样的文档,很高兴被证明是错误的,我在所有时间搜索在这里。
I have a collection called 2022collection but when I go to set the read access in Firestore rules it errors out, I've searched the docs and stackoverflow and am not seeing anything anywhere on how to write the rule properly to allow a collection starting with a number. I can write and read to it just fine if I'm logged in to the app, but unable to make a firestore rule to make it publicly readable. Rules for collections that start with a letter work just fine but the number errors out completely.
How do I make a Cloud Firestore rule for a document/collection that starts with a number?
Here are a couple things I've tried, clearly neither work. I would argue that there should be better documentation on this as I've failed to find anything that explains it. Happy to be proved wrong if such docs exist, I've not found them in an all my time searching here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用通配符读取收集名称,然后使用
matches()
检查它是否以数字开头。试试易货规则:请注意,由于您拥有通配符,因此将适用于所有集合的规则。
You can use a wildcard to read collection name and then use
matches()
to check if it starts with a number. Try the follwoing rules:Do note that this rule will be applied for all collections since you have a wildcard.
我最终通过更改第二个字段的代码来修复它,
我
能够保存规则并阅读Collection 2022user。
I ended up fixing it by changing my code from
to
After changing the second field I was able to save the rule and read the collection 2022users.