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

101
Vistas
Get Single Doc Firebase 9

Im trying to get a single doc and delete it but im having trouble. Ive followed a tutorial exactly but I keep getting the error 'doc is not a function' on the first instance of doc

This is the code im using...

const deleteRef = doc(db, 'users', id); 

getDoc(deleteRef).then((doc) => { 
     console.log(doc.data(), doc.id) 
});

What am I doing wrong?

In another site I have built, the word doc is yellow in VS code But in this site im building now doc is going blue

I do have doc being imported from the Firebase SDK in both sites.

Just realised if I write doc() at the top of my code its yellow but if its lower down its blue

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm not totally sure how your complete code looks like. But try naming multiple variables/function with different names to reduce any confusion. Try refactoring the code as shown below:

import { doc, getDoc } from "firebase/firestore"

const deleteRef = doc(db, 'users', id); 

getDoc(deleteRef).then((snapshot) => { 
  console.log(snapshot.data(), snapshot.id) 
});

If you still get the same error, please check if you have doc declared anywhere else and share the complete code.

about 4 years ago · Juan Pablo Isaza Denunciar
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