Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!