문제

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?

도움이 되었습니까?

해결책

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

".write": "$userID + '' == auth.id"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top