Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
How to read all nested collections of all users on firestore?

So I'm aware you can read through your own nested collections while having the following:

db.collection('usuarios').doc(user.uid).collection('pedidos').doc()

but that would only read all the "pedidos" of that current user

I'm making some kind of "admin" so I need to see ALL the "pedidos" of ALL users and if I remove the values of .doc(user.uid) it will not go through all users it will just not do anything

ej: db.collection("usuarios").doc().collection("estudiantes") <- This didn't work

So I'm looking for a way to read all users nested collection

I can read all users without issues is as simple as db.collection("usuarios") but I need to access their nested collection and I can't do something like db.collection("usuarios").collection("pedidos") that will give me an error. Any help is welcome

enter image description here

update based on suggestion

useEffect(() => { 
    const usuariosRef = db.collectionGroup('pedidos').get()
    usuariosRef.onSnapshot(snapshot => {
      const tempData = [];
      snapshot.forEach((doc) => {
        const data = doc.data();
        
        tempData.push(data);
      });
      setEstudiantes(tempData);
    })

}, [user]);

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda