1.0.1 • Published 7 years ago

firestore-multibatch v1.0.1

Weekly downloads
13
License
Apache-2.0
Repository
github
Last release
7 years ago

firestore-multibatch

NPM version Build Code coverage Dependencies Dev dependencies

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));
1.0.1

7 years ago

1.0.0

7 years ago