Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

278
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda