title: How to prevent spam likes (multiple writes in db) from a single user in firestore
body: <p>so I'm building kind of a social app in react native and firestore. I want to let a user &quot;favorite&quot; a shop . I added a favoritesShops array in my user doc cause I need to compare the nearby shops id to the ones containg in this array. I also have another collection for analytics that let me save a doc in this structure userId+&quot;@&quot;+ShopId and the status: 1 for &quot;favorite&quot; and -1 for &quot;not favorite&quot;. For now I made a button next to each shop to favorite the shop. So each click triggers a batch.set on analytics and batch.update on the array. Everything works as expected but now a single user can spam the &quot;favorite&quot; button trigerring a lot of batch writes for each 1 or -1 (and updating the array). So my question is, how do i prevent this?</p>