I'm working on an app where you can follow/unfollow other app users. So in firestore i've got a collections of users, and each user contains a property named followers. Followers is an array of userId's.
Like this:
"users": {
"user1": {
"name": "Jack",
"imageUrl": "http://lorempixel.nl",
"followers": ["user1", "user2"]
}
}
Question
How to write a security rule in firestore, so only the current user can read/write their own object, but others can add/delete their user id to the array of followers.