我的代码删除了文档中的字段,但是空文档保留在集合中,我想删除文档时它是空的....我是新来的这个plz帮助...谢谢
我删除字段的代码
function deletedb(inputx)
{
firestore.collection("products").where("Product", "==", inputx)
.get()
.then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
var databaseRef = firestore.collection("products").doc(doc.id)
var removeProduct = databaseRef.update({
Product: firebase.firestore.FieldValue.delete()
});
var removePer = databaseRef.update({
Per: firebase.firestore.FieldValue.delete()
});
var removeArea = databaseRef.update({
Area: firebase.firestore.FieldValue.delete()
});
var removeCost = databaseRef.update({
Cost: firebase.firestore.FieldValue.delete()
});
var removeDescription = databaseRef.update({
Description: firebase.firestore.FieldValue.delete()
});
});
})
}