Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. const batchArray = []
  2. var index = 0
  3. docArray.forEach(ar => ar.forEach(doc => {
  4. if (index%500 === 0) {
  5. batchArray.push(db.batch())
  6. }
  7. batchArray[batchArray.length-1].update(doc.ref, {app: app})
  8. index++
  9. }))
  10. batchArray.forEach(async batch => await batch.commit())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement