Firestore Rule: Only strings in List

北慕城南 提交于 2019-12-31 04:30:11

问题


How can I check if there are only strings in request.resource.data.myArray?

Loops and recursive calls are not allowed.


回答1:


This is not possible today, unless you know the size of the array, and you write an expression to check the element at each index. However, what you're asking is a reasonable thing to want to do, and you should file a feature request for it. Bear in mind, though, that it's a long way off from happening.

The only way this would eventually work is if the rules language had a lambda type where you could pass a predicate function into a method that ensures it only returns true for every element in the list. But that concept doesn't exist right now, so it would require a fair amount of effort to implement.



来源:https://stackoverflow.com/questions/55071893/firestore-rule-only-strings-in-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!