Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
Firestore Security Rules for Query with IN

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

Story2 story2 doc

Story3 story3 doc

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!