Frage

The Firebase security rules do strict equality checks but I'd like to be able to check and ignore type where $userID may be a string or number. i.e. $userID = 1 or $userID = '1' and auth.id is a string.

".write": "$userID == auth.id"

I tried .toString() but it doesn't appear to be supported.

 ".write": "$userID.toString() == auth.id"

Is this possible?

War es hilfreich?

Lösung

If you absolutely have to convert you could add an empty string, but you normally shouldn't need to:

".write": "$userID + '' == auth.id"
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top