Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

401
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda