'Firestore only allow modification of field if user not contained in array

I have a document like

Field Score: number
Field usersThatRated: array 

How can I enforce in the firestore rules that only users whose id is NOT included in the usersthatRated array are allowed to increment/decrement the score?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source