Firestore security rules for objects inside of the array
Hi everyone!
In my Firestore, I have a collection called "items" and there are couple of documents inside. Some of these documents have "reviews" property, which is created by
In my front-end, I'm sending a get request to get the whole reviews array, like this:
How can I write my security rules so that
I asked ChatGPT to help me write the rules, but these doesn't work:
And my query looks like this (Typescript):
In my Firestore, I have a collection called "items" and there are couple of documents inside. Some of these documents have "reviews" property, which is created by
arrayUnion() called from my front-end and the objects inside of this array always have 4 properties, one of them is userId. In my front-end, I'm sending a get request to get the whole reviews array, like this:
doc.data().reviews.How can I write my security rules so that
userId is never returned no matter what?I asked ChatGPT to help me write the rules, but these doesn't work:
And my query looks like this (Typescript):