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

175
Visualizações
update subcollection field in firestore

i have a firestore collection and want to update a couple fields in it's subcollection, which is in the form of an array. I cannot manage to do this. the data parameter gets me exactly what I want, and then i slice it to get the last array in subcollection. Have broken it down to collection('').doc('').collection(''), as well, with no luck. Thank you for any help!

async updateDialogueStatus({ state }, data){
    const whoDis =  this.$fire.auth.currentUser
    if (data.dialogue.length > 0) {
      const lastDialogueInArray = data.dialogue.slice(-1)[0];
      this.$fire.firestore.collection('conversations/' + data.id + 'dialogue/' + lastDialogueInArray.messageId).update({
           status: "read",
           readBy: whoDis.email
      })
    } else {}

i get this error: "Uncaught (in promise) TypeError: _this2.$fire.firestore.collection(...).update is not a function"

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

0

You're constructing a path to the document to update, but then call this.$fire.firestore.collection. Call .doc to get the correct object, on which you can call update.

//                   👇                                👇
this.$fire.firestore.doc('conversations/' + data.id + '/dialogue/' + lastDialogueInArray.messageId).update({
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