Firebase Firestore安全规则的集合名称中的空格 [英] Spaces in collection name for Firebase Firestore security rules

查看:79
本文介绍了Firebase Firestore安全规则的集合名称中的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有一个销售伙伴"集合.我正在尝试编写安全规则:

For example I have a collection "sales associates". I am trying to write the security rule:

allow read: if exists(/databases/$(database)/documents/sales associates/$(request.auth.uid));

但是我收到一个错误,因为销售助理"中有空格.您如何在集合名称中写一个空格?在销售助理周围写引号无效.

But I am getting an error because "sales associates" has a space in it. How do you write in the collection name with a space? Writing quotes around sales associates does not work.

推荐答案

在整个内容周围加上引号:

Put quotes around the entire thing:

allow read: if exists("/databases/$(database)/documents/sales associates/$(request.auth.uid)");

这篇关于Firebase Firestore安全规则的集合名称中的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆