Doug Allrich
Doug Allrich

Reputation: 857

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?

Upvotes: 3

Views: 365

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317292

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.

Upvotes: 2

Related Questions