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

171
Visualizações
Firestore query the documents in subcollections using their IDs

I have a structure of nested subcollections and documents. Each name of the documents in the experience subcollection represents userId of some user that has experience in that game.

DB structure

I have a converted that attaches this userId to the document:

experienceEntity.userId = snapshot.id;
experienceEntity.experience = snapshot.data().experience;

I want to query documents from all the experience subcollections of all the games that have a certain userId. E.g. I want to get all documents having 400riCGTB0YkxAF52maPUr5jKPN2 ID from the screenshot above. I was trying this:

const result = await firestore()
  .collectionGroup("experience")
  .withConverter(gameExperienceEntityConverter)
  .where("userId", "==", userId)
  .get();

return result.docs.map((snap) => snap.data());

... but it returns an empty array. If I remove the where clause - it returns all the documents from all experience subcollections without any filtering (there can potentially be millions of those at this point).

about 4 years ago · Santiago Gelvez
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