Reputation: 2660
How to use the JS native array.contains in Firestore rules?
function isCool() {
return [
'xxx',
'yyy',
].contains(req.auth.uid)
}
The function above gives an error
Upvotes: 0
Views: 612
Reputation: 50930
You are looking for in
operator:
function isCool() {
return request.auth.uid in ['xxx', 'yyy'];
}
It returns true if the value is present in the given list/array.
Upvotes: 6