Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

279
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda