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

399
Views
Firestore rules - wildcard not getting data?

Hi I'm looking for help regarding some Firestore rules.

For some reason wildcards don't seem to work, or I'm doing something wrong...

Basically I'm trying to only allow 'read' permissions on a document collection if the companyId exists in their own user document.

So for example, I have a collection called "companies/16bc5ecc247a9". In my user document I have a field of companyId: "16bc5ecc247a9".

So, If companyId: "16bc5ecc247a9" matches a collection inside another collection called 'companies' it'll grant permission

Here are the rules I'm using:

match /companies/{companyName}  {

      function comp() {
        return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.companyId == companyName;
      }
      
    allow read, write : if comp()      
}

So as you can see I'm trying to say if the document name matches the value inside the user field allow

Here is a screenshot of my data

If it's needed, Here is all of my rules I'm using

I hope this make sense, Thanks in advance.

about 4 years ago · Juan Pablo Isaza
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!