000000000000000000000
000000000000000000000

Reputation: 1467

Firestore Rule: Only strings in List

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

Loops and recursive calls are not allowed.

Upvotes: 2

Views: 208

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317750

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.

Upvotes: 3

Related Questions