Skip to content

Drop-in replacement for firebase.firestore.WriteBatch that works without batch operations limit.

License

Notifications You must be signed in to change notification settings

stpch/firestore-multibatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');
require('firebase/firestore');
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));

About

Drop-in replacement for firebase.firestore.WriteBatch that works without batch operations limit.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published