Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 639
Doug Allrich Avatar asked Nov 19 '25 09:11

Doug Allrich


1 Answers

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.

like image 84
Doug Stevenson Avatar answered Nov 21 '25 08:11

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!