将Firestore安全规则Set()转换为字符串值

时间:2020-04-17 00:55:32

标签: firebase google-cloud-firestore firebase-security

根据Firestore安全规则文档,使用affectedKeys() MapDiff函数将返回rules.Set()

function getName() {
  return ({"alice":"owner", "john":"writer"}).diff({"john":"writer"}).affectedKeys();
}

在上面的示例中,将从函数中返回["alice"],但返回的是Set类型,而不是List类型。

我需要将返回值强制转换为字符串("alice")而不是Set,但是到目前为止,我还没有找到一种方法。有可能做到这一点吗?

1 个答案:

答案 0 :(得分:1)

如果可以将Set转换为List,就会有。但是没有这种转换,这是不可能的。我建议通过Firebase support提交功能请求。