Search code examples
firebasegoogle-cloud-firestorefirebase-security

Convert a Firestore Security Rules Set() to a String value(s)


According to the Firestore security rules docs, using the affectedKeys() MapDiff function will return a rules.Set().

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

In the example above, ["alice"] would be returned from the function, but as a Set type, not a List type.

I am in need of casting the returned value as a String ("alice") rather than a Set, but so far am unable to find a way to do that. Is it possible to achieve this?


Solution

  • There would be, if you could convert a Set to a List. But without that conversion, it's not possible. I suggest filing a feature request with Firebase support.