【发布时间】:2021-01-15 14:30:34
【问题描述】:
我想删除一个文档并从中删除一个特定的子集合。我正在使用网络客户端。如何检索子集合中的所有文档并删除它们?这是我现在拥有的:
let id = e.target.parentElement.getAttribute('data-id');
if (accountType == 'admin') {
if(confirm("Are you sure you want to delete this event?")) {
db.collection('campouts').doc(docIdDoc).collection('attending').get().then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
doc.delete();
});
});
db.collection('campouts').doc(id).delete().then(() => {
});
当我单击按钮时,我在控制台中收到此错误:
script.js:123 Uncaught (in promise) TypeError: doc.delete is not a function
【问题讨论】:
标签: javascript google-cloud-firestore