Valid way to delete a doc from firebase

I want to delete a game from my firestore collection, but i get error:

TypeError: doc is not a function

I am using the latest version of Firebase. What is the proper way to delete the doc?

import {where,query,deleteDoc,collection, doc, getDocs, getFirestore } from "firebase/firestore";
deleteGame(game)  {            
  const db = getFirestore();
  const q = query(collection(db, "history"), where("date", "==",;
  const doc = getDocs(q);
  const quer = await getDocs(q);

  quer.forEach((doc) => 
       deleteDoc(doc(db, "history",;


According to firebase documentation for delete data you should indeed use

deleteDoc(doc(db, "history",;  

But doc needs to be the function imported from firebase/firestore . You are rewriting the value of doc with the element from quer ( quer.forEach((doc) => ).

You also have const doc = getDocs(q); so you will need change the name of both doc variables in order to use the imported function inside the forEach callback.

Also keep in mind that this won’t subcollections (if you have any – as specified in the docs).