I am doing a query
firestore().collection('stories')
.where('published', '==', true)
.where(firestore.FieldPath.documentId(), 'in', storyIds)
.get()
I have a rule for stories
match /stories/{storyId} {
allow read: if resource.data.published == true;
}
And getting an error [firestore/permission-denied] if there is id of unpublished story in my list. What am i doing wrong?
UPDATED
storyIds=["story2","story3"]
Firestore Docs
I've found solution. Just added my documentId
in document as id
and changed query.
firestore().collection('stories')
.where('published', '==', true)
.where('id', 'in', storyIds)
.get()
This works now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.