我刚刚更改了我的代码,它正在运行。可以在google cloud-firestore中批量删除。
async deleteMembersOfGroup(clubId: string, groupId: string) {
//path of the collection
const path = "club/" + clubId + "/group/" + groupId + "/group-members";
//query snapshot
const qry: firebase.firestore.QuerySnapshot = await this.afs.collection(path).ref.get();
const batch = this.afs.firestore.batch();
//looping through docs in the collection to delete docs as a bulk operation
qry.forEach(doc => {
console.log('deleting....', doc.id);
batch.delete(doc.ref);
});
//finally commit
batch.commit().then(res => console.log('committed batch.'))
.catch(err => console.error('error committing batch.', err));
}