i recently began to use firebase and i ran into a problem, to get it straight, i want to make a e-commerce site, ofcourse it has cart, i used firebase for my back-end, for every user, i create a document in “users” collection, each user’s document id is the uid of that given user. On every document, i have a cart, and in the cart, the products, on my cart page, i want to have a “Empty Cart” that deletes all the products, meaning it deletes “cart” collection. How can i do that? I have left some photos below that will probably explain the problem better.
I tried this and it did not work!
const deleteCart = async () => {
const cartDoc = `users/${user.uid}/cart`
await deleteDoc(db, cartDoc)
}
i get this error : ” TypeError: Cannot use ‘in’ operator to search for ‘_delegate’ in undefined “