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

505
Visualizações
Property 'update' does not exist on type 'DocumentReference<DocumentData>' Typescript

I am trying to do an update to a Firebase firestore document. However, I am getting the error

Property 'update' does not exist on type 'DocumentReference'

    const Firestore = initializeFirestore(Firebase);

    const vendorsRef = collection(Firestore, '/vendors');
    const q = query(vendorsRef, where("uuid", "==", vendorUuid))
    const querySnapshot = await getDocs(q);
    
    querySnapshot.forEach(async (doc) => {
      const delRes = await doc.ref.update({deleted: '06-02-2022'});  // doing soft delete
    });

Any suggestions as to why this is? When I did into the node_modules, the update function appears to be there. Seems like a typescript issue maybe? I have also tried doing it the other style I've found where I use

Firestore.collection('vendors').doc('something').set(data);

But in that style, it tells me that Property 'collection' does not exist on type 'Firestore'

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The error is telling you that there is no method "update" on v9 DocumentReference. If you look through the linked API doc, you will see that is definitely the case.

It seems you are maybe mixing up the JavaScript v8 and v9 APIs. v8 does have update as a method on DocumentReference but v9 does not. If you want to update a document using v9 as you are currently using, you should follow the documentation for that and use the updateDoc function.

import { updateDoc } from "firebase/firestore";

await updateDoc(doc.ref, {deleted: '06-02-2022'});
about 4 years ago · Juan Pablo Isaza Relatório
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