Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

283
Views
Delete item from a subcollection in firebase with react

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);

enter image description here

How the database looks like:

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!