firestore-multibatch
v1.0.1
Published
Drop-in replacement for firebase.firestore.WriteBatch that works without batch operations limit.
Downloads
68
Readme
firestore-multibatch
Drop-in replacement for firebase.firestore.WriteBatch that works around Firestore's 500 batch operations limit.
Installation
npm install firestore-multibatch
Usage
const firebase = require('firebase');
const {MultiBatch} = require('firestore-multibatch');
firebase.initializeApp({/* ... */});
const db = firebase.firestore();
const batch = new MultiBatch(db); // Instead of db.batch()
// Perform batch operations same as with db.batch()
for (let i = 0; i < 1000; i++) {
batch.set(db.collection('test').doc(), {foo: 'bar'});
}
batch.commit()
.then(() => console.log('Batch operations committed'))
.catch(err => console.error(err));