【发布时间】:2018-07-07 13:59:56
【问题描述】:
我的集合中有几百个文档。其中很少有人损坏,我想删除它们。我知道如何找到损坏的文档,并通过查询获得它们。但它只是一个数据,没有文档 ID 或任何东西。
所以我的问题是,如何删除我在查询中收到的文档?或者还有其他方法如何根据某些属性删除文档?
getData(target) {
return this.afs.collection('someCollection', ref => {
let query: firebase.firestore.CollectionReference | firebase.firestore.Query = ref;
query = query.where('label', '==', target);
return query;
});
}
this.dataService.getData('CorruptedLabel').valueChanges().subscribe(resp => {
console.log('resp', resp); // Here I get and array of objects
// I would like to go through that array and call delete() on each item
});
【问题讨论】:
标签: angularfire2 google-cloud-firestore