Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!