【发布时间】:2021-11-08 09:48:47
【问题描述】:
有人可以解释我如何使用 v9 使用 reactjs 删除 firebase/firestore 中的集合
firestore()
.collection('rate')
.get()
.then((querySnapshot) => {
querySnapshot.forEach((doc) => {
doc.ref.delete();
});
我在 v8 中使用的这段代码在 v9 中需要同样的东西
const q = query(collection(db, `${udata.id}`));
const querySnapshot = await getDocs(q);
querySnapshot.forEach((doc) => {
// doc.data() is never undefined for query doc snapshots
console.log(doc.data());
});
已经尝试过了,但是这段代码只能读取数据,我不能删除,所以有人可以告诉我怎么做
【问题讨论】:
标签: javascript reactjs firebase google-cloud-firestore