src/collectionTools.js
//conditionalFunc takes id and data. Return true to delete, false to ignore.
conditionalFunc takes id and data. Return true to delete, false to ignore.
conditionalFunc takes id and data . Return true to delete false to ignore .
function DeleteDocumentsWhere(collection, conditionalFunc)
{
    return collection.get()
        .then(qrySnapshot=>{
            const promises = [];
            qrySnapshot.forEach(doc=>{
                if(conditionalFunc(doc.id, doc.data()))
                {
                    promises.push(collection.doc(doc.id).delete());
                }
            });
            return Promise.all(promises);
        });
}
function DeleteDocumentsWhere ( collection , conditionalFunc ) { return collection . get ( ) . then ( qrySnapshot => { const promises = [ ] ; qrySnapshot . forEach ( doc => { if ( conditionalFunc ( doc . id , doc . data ( ) ) ) { promises . push ( collection . doc ( doc . id ) . delete ( ) ) ; } } ) ; return Promise . all ( promises ) ; } ) ; }
conditionalFunc takes id and data.
conditionalFunc takes id and data .