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

306
Visualizações
How to "Get all documents in a collection" in Firestore?

I saw the example code which "Get all documents in a collection" from the doc.

import { collection, getDocs } from "firebase/firestore";

const querySnapshot = await getDocs(collection(db, "cities"));
querySnapshot.forEach((doc) => {
  // doc.data() is never undefined for query doc snapshots
  console.log(doc.id, " => ", doc.data());
});

But I'm wondering if this really will get all the documents from the collection.

I've used DynamoDB before, in DynamoDB you can't just get all the items in a table at once, to get all the items in a table you have to paginate(send multiple requests) if the data set is too large. For example if the size of all the items is 10MB, you have to send 10 requests to get all the items.

I'm wondering if this limit also applies to Firestore? Can I really get all the data of a collection in just one request even if the size was like 1GB?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I'm wondering if this really will get all the documents from the collection.

Yes it will. That's in fact precisely why that code sample is in the documentation on getting all documents in a collection.

If you think this number of documents may grow beyond what the connection or device can handle, you limit the maximum number of documents that are retrieved. If you want to then show more documents optionally, you can implement cursor-based pagination.

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