I made the subcollection 'medicine" from the collection 'users', im trying to delete each item from that subcollection when clicking a button, this is what i did:
import {auth, db} from "../../firebase/firebase.config";
import {doc, deleteDoc} from "firebase/firestore";
function BotonEliminar(id) {
const user = auth?.currentUser?.uid;
const deleteElement = async () =>{
await deleteDoc(doc(db, 'users', user, 'medicine', id));
}
.... etc
I got in the console:
Uncaught (in promise) TypeError: n.indexOf is not a function
I don't know what I doing wrong. I get the id and the user correctly.
Doing the console.log(db, user, id);

How the database looks like:
