I was making a function to clear all documents inside a nested collection. I've accessed it as follow.
const deleteChat = async () => {
const chatSnapShot = await db
.collection("chats")
.doc(router.query.id)
.collection("messages")
.get();
chatSnapShot.forEach((doc) => {
console.log(doc.data());
});
};
How can I do that? This doc.data() returns the data inside the messages collection. I've tried using other solutions but things doesn't work. Help would be appreciated :)