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

129
Visualizações
Firestore Batch writes get rollbacked like Transaction does?

Trying to write more than 500 documents using Firestore Batch. And I'm wondering if all the batch writes get rollbacked automatically if any batch write fails. If not, how can I achieve that, is there any way to overcome the 500 writes limit with Transaction.

  const BATCH_CHUNK = 500
  const batches = []
  for (let i = 0; i < snapshot.docs.length; i += BATCH_CHUNK) {
    const batch = db.batch()
    snapshot.docs.slice(i, i + BATCH_CHUNK).forEach(doc => {
      batch.update(doc.ref, { committed: true })
    })
    batches.push(batch.commit())
  }

  await Promise.all(batches)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Batch writes are executed atomically indeed. If one of the writes gets rejected by say security rules, the other writes in that batch are rejected too. So either all writes in a batch are committed, or none of them are.

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